46 const circle::Tensor *input1;
47 const circle::Tensor *input2;
48 const circle::Tensor *
output;
54 uint16_t input1_index = 0;
55 uint16_t input2_index = 0;
57 const circle::AddOptions *
options;
61 runtime_kernel.
readKernel(op_index, runtime_context);
66 assert(input1 !=
nullptr);
67 assert(input2 !=
nullptr);
68 assert(output !=
nullptr);
75 assert(input1_data !=
nullptr);
76 assert(input2_data !=
nullptr);
77 assert(output_data !=
nullptr);
95 if (input_1_dynamic_shape.flatSize() != 0)
96 input1_shape = input_1_dynamic_shape;
99 if (input_2_dynamic_shape.flatSize() != 0)
100 input2_shape = input_2_dynamic_shape;
107 switch (input1->type())
110 case circle::TensorType_FLOAT32:
113 ¶ms.float_activation_min, ¶ms.float_activation_max);
117 params, input1_shape, core::utils::castInputData<float>(input1_data), input2_shape,
118 core::utils::castInputData<float>(input2_data),
output_shape,
119 core::utils::castOutputData<float>(output_data));
125 core::utils::castInputData<float>(input2_data),
126 core::utils::castOutputData<float>(output_data));
131 case circle::TensorType_INT64:
134 ¶ms.int64_activation_min, ¶ms.int64_activation_max);
139 params, input1_shape, core::utils::castInputData<int64_t>(input1_data), input2_shape,
140 core::utils::castInputData<int64_t>(input2_data),
output_shape,
141 core::utils::castOutputData<int64_t>(output_data));
145 status =
pal::Add(params, input1_shape.flatSize(),
146 core::utils::castInputData<int64_t>(input1_data),
147 core::utils::castInputData<int64_t>(input2_data),
148 core::utils::castOutputData<int64_t>(output_data));
152 case circle::TensorType_INT32:
155 ¶ms.int32_activation_min, ¶ms.int32_activation_max);
160 params, input1_shape, core::utils::castInputData<int32_t>(input1_data), input2_shape,
161 core::utils::castInputData<int32_t>(input2_data),
output_shape,
162 core::utils::castOutputData<int32_t>(output_data));
166 status =
pal::Add(params, input1_shape.flatSize(),
167 core::utils::castInputData<int32_t>(input1_data),
168 core::utils::castInputData<int32_t>(input2_data),
169 core::utils::castOutputData<int32_t>(output_data));
174 case circle::TensorType_INT8:
179 options->fused_activation_function());
184 add_params, input1_shape, core::utils::castInputData<int8_t>(input1_data), input2_shape,
185 core::utils::castInputData<int8_t>(input2_data),
output_shape,
186 core::utils::castOutputData<int8_t>(output_data));
190 status =
pal::Add(add_params, input1_shape.flatSize(),
191 core::utils::castInputData<int8_t>(input1_data),
192 core::utils::castInputData<int8_t>(input2_data),
193 core::utils::castOutputData<int8_t>(output_data));
201 assert(
false &&
"Unsupported type.");
OMRuntimeShape getDynamicRuntimeShape(uint16_t tensor_index)
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]
int32_t inputs_index[maxInputSize]
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 BroadcastAdd4DSlow(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)
bool processBroadcastShapes(const core::OMRuntimeShape &shape0, const core::OMRuntimeShape &shape1, core::BinaryArithmeticBroadcastParams *params)
OMStatus Add(const core::ArithmeticQuantParams ¶ms, const uint32_t flat_size, const int8_t *input1_data, const int8_t *input2_data, int8_t *output_data)
void calculateQuantParams(core::ArithmeticQuantParams ¶ms, const circle::Tensor *input1, const circle::Tensor *input2, const circle::Tensor *output, circle::ActivationFunctionType act)
OMStatus calculateActivationRange(circle::ActivationFunctionType activation, T *activation_min, T *activation_max)
core::OMRuntimeContext & runtime_context
core::OMRuntimeStorage & runtime_storage