34constexpr uint32_t numInput = 2;
35constexpr uint32_t numOutput = 1;
51 const circle::Tensor *input1;
52 const circle::Tensor *input2;
53 const circle::Tensor *
output;
59 const circle::SubOptions *
options;
63 runtime_kernel.
readKernel(op_index, runtime_context);
68 assert(input1 !=
nullptr);
69 assert(input2 !=
nullptr);
70 assert(output !=
nullptr);
77 assert(input1_data !=
nullptr);
78 assert(input2_data !=
nullptr);
79 assert(output_data !=
nullptr);
93 switch (input1->type())
96 case circle::TensorType_FLOAT32:
99 ¶ms.float_activation_min,
100 ¶ms.float_activation_max);
105 params, input1_shape, core::utils::castInputData<float>(input1_data), input2_shape,
106 core::utils::castInputData<float>(input2_data),
output_shape,
107 core::utils::castOutputData<float>(output_data));
112 pal::Sub(params, input1_shape.flatSize(), core::utils::castInputData<float>(input1_data),
113 core::utils::castInputData<float>(input2_data),
114 core::utils::castOutputData<float>(output_data));
118 case circle::TensorType_INT64:
121 ¶ms.int64_activation_min,
122 ¶ms.int64_activation_max);
127 params, input1_shape, core::utils::castInputData<int64_t>(input1_data), input2_shape,
128 core::utils::castInputData<int64_t>(input2_data),
output_shape,
129 core::utils::castOutputData<int64_t>(output_data));
133 status =
pal::Sub(params, input1_shape.flatSize(),
134 core::utils::castInputData<int64_t>(input1_data),
135 core::utils::castInputData<int64_t>(input2_data),
136 core::utils::castOutputData<int64_t>(output_data));
140 case circle::TensorType_INT32:
143 ¶ms.int32_activation_min,
144 ¶ms.int32_activation_max);
149 params, input1_shape, core::utils::castInputData<int32_t>(input1_data), input2_shape,
150 core::utils::castInputData<int32_t>(input2_data),
output_shape,
151 core::utils::castOutputData<int32_t>(output_data));
155 status =
pal::Sub(params, input1_shape.flatSize(),
156 core::utils::castInputData<int32_t>(input1_data),
157 core::utils::castInputData<int32_t>(input2_data),
158 core::utils::castOutputData<int32_t>(output_data));
164 case circle::TensorType_INT8:
169 options->fused_activation_function());
174 sub_params, input1_shape, core::utils::castInputData<int8_t>(input1_data), input2_shape,
175 core::utils::castInputData<int8_t>(input2_data),
output_shape,
176 core::utils::castOutputData<int8_t>(output_data));
180 status =
pal::Sub(sub_params, input1_shape.flatSize(),
181 core::utils::castInputData<int8_t>(input1_data),
182 core::utils::castInputData<int8_t>(input2_data),
183 core::utils::castOutputData<int8_t>(output_data));
191 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 Sub(const core::BinaryArithmeticBroadcastParams ¶ms, const int flat_size, const T *input1_data, const T *input2_data, T *output_data)
bool processBroadcastShapes(const core::OMRuntimeShape &shape0, const core::OMRuntimeShape &shape1, core::BinaryArithmeticBroadcastParams *params)
OMStatus BroadcastSub4DSlow(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 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