32 Tensor::element_type(kernel.
input2()));
34 Tensor::element_type(kernel.
input2()));
36 if (Tensor::element_type(kernel.
input1()) == DataType::S16)
39 Tensor::zero_points(kernel.
input2()).size() == 1);
41 Tensor::zero_point(kernel.
input2()) == 0 &&
42 Tensor::zero_point(kernel.
output()) == 0);
51 const auto *options = cur_op->builtin_options_as_SubOptions();
63 switch (Tensor::element_type(kernel.
input1()))
66 case DataType::FLOAT32:
68 auto tiso_func = luci_interpreter_pal::Sub<float>;
70 auto broadcast_tiso_func = luci_interpreter_pal::BroadcastSub4DSlow<float>;
73 kernels::evalTISOInplaceKernel<float>(tiso_func, broadcast_tiso_func, &kernel, options,
74 std::move(input_shape1), std::move(input_shape2),
80 kernels::evalTISOKernel<float>(tiso_func, broadcast_tiso_func, &kernel, &kernel_data,
81 options, std::move(input_shape1), std::move(input_shape2),
89 auto tiso_func = luci_interpreter_pal::Sub<int64_t>;
91 auto broadcast_tiso_func = luci_interpreter_pal::BroadcastSub4DSlow<int64_t>;
95 kernels::evalTISOInplaceKernel<int64_t>(tiso_func, broadcast_tiso_func, &kernel, options,
96 std::move(input_shape1), std::move(input_shape2),
102 kernels::evalTISOKernel<int64_t>(tiso_func, broadcast_tiso_func, &kernel, &kernel_data,
103 options, std::move(input_shape1), std::move(input_shape2),
110 auto tiso_func = luci_interpreter_pal::Sub<int32_t>;
112 auto broadcast_tiso_func = luci_interpreter_pal::BroadcastSub4DSlow<int32_t>;
116 kernels::evalTISOInplaceKernel<int32_t>(tiso_func, broadcast_tiso_func, &kernel, options,
117 std::move(input_shape1), std::move(input_shape2),
123 kernels::evalTISOKernel<int32_t>(tiso_func, broadcast_tiso_func, &kernel, &kernel_data,
124 options, std::move(input_shape1), std::move(input_shape2),
134 auto tiso_func = [](
const tflite::ArithmeticParams ¶ms,
135 const tflite::RuntimeShape &input1_shape,
const uint8_t *input1_data,
136 const tflite::RuntimeShape &input2_shape,
const uint8_t *input2_data,
137 const tflite::RuntimeShape &
output_shape, uint8_t *output_data) {
138 tflite::reference_ops::Sub(params, input1_shape, input1_data, input2_shape, input2_data,
141 auto broadcast_tiso_func =
142 [](
const tflite::ArithmeticParams ¶ms,
const tflite::RuntimeShape &input1_shape,
143 const uint8_t *input1_data,
const tflite::RuntimeShape &input2_shape,
144 const uint8_t *input2_data,
const tflite::RuntimeShape &
output_shape,
145 uint8_t *output_data) {
146 tflite::reference_ops::BroadcastSubSlow(params, input1_shape, input1_data, input2_shape,
151 kernels::evalTISOInplaceQuantizedKernel<uint8_t>(tiso_func, broadcast_tiso_func, &kernel,
157 kernels::evalTISOQuantizedKernel<uint8_t>(tiso_func, broadcast_tiso_func, &kernel,
158 &kernel_data, options);
165 assert(
false &&
"Unsupported type.");