39 const circle::Tensor *input2,
const circle::Tensor *output,
40 circle::ActivationFunctionType act)
62 double real_multiplier =
static_cast<double>(input1_scale) *
static_cast<double>(input2_scale) /
63 static_cast<double>(output_scale);
81 const circle::Tensor *input1;
82 const circle::Tensor *input2;
83 const circle::Tensor *
output;
89 const circle::MulOptions *
options;
93 runtime_kernel.
readKernel(op_index, runtime_context);
98 assert(input1 !=
nullptr);
99 assert(input2 !=
nullptr);
100 assert(output !=
nullptr);
107 assert(input1_data !=
nullptr);
108 assert(input2_data !=
nullptr);
109 assert(output_data !=
nullptr);
123 switch (input1->type())
126 case circle::TensorType_FLOAT32:
129 ¶ms.float_activation_min,
130 ¶ms.float_activation_max);
135 params, input1_shape, core::utils::castInputData<float>(input1_data), input2_shape,
136 core::utils::castInputData<float>(input2_data),
output_shape,
137 core::utils::castOutputData<float>(output_data));
142 pal::Mul(params, input1_shape.flatSize(), core::utils::castInputData<float>(input1_data),
143 core::utils::castInputData<float>(input2_data),
144 core::utils::castOutputData<float>(output_data));
148 case circle::TensorType_INT64:
151 ¶ms.int64_activation_min,
152 ¶ms.int64_activation_max);
157 params, input1_shape, core::utils::castInputData<int64_t>(input1_data), input2_shape,
158 core::utils::castInputData<int64_t>(input2_data),
output_shape,
159 core::utils::castOutputData<int64_t>(output_data));
163 status =
pal::Mul(params, input1_shape.flatSize(),
164 core::utils::castInputData<int64_t>(input1_data),
165 core::utils::castInputData<int64_t>(input2_data),
166 core::utils::castOutputData<int64_t>(output_data));
170 case circle::TensorType_INT32:
173 ¶ms.int32_activation_min,
174 ¶ms.int32_activation_max);
179 params, input1_shape, core::utils::castInputData<int32_t>(input1_data), input2_shape,
180 core::utils::castInputData<int32_t>(input2_data),
output_shape,
181 core::utils::castOutputData<int32_t>(output_data));
185 status =
pal::Mul(params, input1_shape.flatSize(),
186 core::utils::castInputData<int32_t>(input1_data),
187 core::utils::castInputData<int32_t>(input2_data),
188 core::utils::castOutputData<int32_t>(output_data));
194 case circle::TensorType_INT8:
198 calculateQuantParamsForMul(add_params, input1, input2, output,
199 options->fused_activation_function());
204 add_params, input1_shape, core::utils::castInputData<int8_t>(input1_data), input2_shape,
205 core::utils::castInputData<int8_t>(input2_data),
output_shape,
206 core::utils::castOutputData<int8_t>(output_data));
210 assert(input1_shape.flatSize() == input2_shape.flatSize());
212 status =
pal::Mul(add_params, input1_shape.flatSize(),
213 core::utils::castInputData<int8_t>(input1_data),
214 core::utils::castInputData<int8_t>(input2_data),
215 core::utils::castOutputData<int8_t>(output_data));
223 assert(
false &&
"Unsupported type.");
uint8_t * outputs_data[maxOutputSize]
const circle::Operator * first_operator
OMStatus getDataFromStorage(uint16_t op_index, core::OMRuntimeStorage &storage, core::OMRuntimeContext &context)
uint8_t * inputs_data[maxInputSize]
OMStatus readKernel(uint16_t op_index, core::OMRuntimeContext &runtime_context)
const circle::Tensor * outputs[maxOutputSize]
const circle::Tensor * inputs[maxInputSize]
const luci_interpreter::RuntimeShape output_shape
constexpr uint32_t input1TensorIdx
constexpr uint32_t outputTensorIdx
constexpr uint32_t input2TensorIdx
const std::vector< float > input1_data
const std::vector< float > input2_data
OMStatus BroadcastMul6DSlow(const core::ArithmeticQuantParams ¶ms, const core::OMRuntimeShape &input1_shape, const T *input1_data, const core::OMRuntimeShape &input2_shape, const T *input2_data, const core::OMRuntimeShape &output_shape, T *output_data)
bool processBroadcastShapes(const core::OMRuntimeShape &shape0, const core::OMRuntimeShape &shape1, core::BinaryArithmeticBroadcastParams *params)
OMStatus Mul(const core::ArithmeticQuantParams ¶ms, const uint32_t flat_size, const int8_t *input1_data, const int8_t *input2_data, int8_t *output_data)
OMStatus BroadcastMul4DSlow(const core::BinaryArithmeticBroadcastParams ¶ms, const core::OMRuntimeShape &input1_shape, const T *input1_data, const core::OMRuntimeShape &input2_shape, const T *input2_data, const core::OMRuntimeShape &output_shape, T *output_data)
void quantizeMultiplier(double double_multiplier, int32_t *quantized_multiplier, int *shift)
void readQuantParams(const circle::Tensor *tensor, long &zero_point, float &scale)
OMStatus calculateActivationRangeQuantized(circle::ActivationFunctionType activation, int32_t output_zero_point, float output_scale, circle::TensorType data_type, int32_t *activation_min, int32_t *activation_max)
OMStatus calculateActivationRange(circle::ActivationFunctionType activation, T *activation_min, T *activation_max)
int32_t quantized_activation_min
int32_t quantized_activation_max
int32_t output_multiplier
core::OMRuntimeContext & runtime_context
core::OMRuntimeStorage & runtime_storage