@@ -16,6 +16,8 @@ namespace native {
1616
1717using ::executorch::aten::Tensor;
1818using ::executorch::runtime::KernelRuntimeContext;
19+ using ::impl::reference::kernels::dequantize;
20+ using ::impl::reference::kernels::quantize;
1921
2022void quantized_add_asym8uxasym8u_asym8u_per_tensor_out (
2123 KernelRuntimeContext& ctx,
@@ -61,25 +63,19 @@ void quantized_add_asym8uxasym8u_asym8u_per_tensor_out(
6163 }
6264 } /* if Y is a scalar Tensor */
6365 else if (Y_numel == 1 ) {
64- float y =
65- kernels::dequantize<uint8_t >(Y_data[0 ], Y_scale_f, Y_zero_point_i32);
66+ float y = dequantize<uint8_t >(Y_data[0 ], Y_scale_f, Y_zero_point_i32);
6667 for (size_t i = 0 ; i < X_numel; ++i) {
67- float x =
68- kernels::dequantize<uint8_t >(X_data[i], X_scale_f, X_zero_point_i32);
68+ float x = dequantize<uint8_t >(X_data[i], X_scale_f, X_zero_point_i32);
6969 float z = x + y;
70- out_data[i] =
71- kernels::quantize<uint8_t >(z, inv_out_scale, out_zero_point_i32);
70+ out_data[i] = quantize<uint8_t >(z, inv_out_scale, out_zero_point_i32);
7271 }
7372 } /* if X is a scalar Tensor */
7473 else if (X_numel == 1 ) {
75- float x =
76- kernels::dequantize<uint8_t >(X_data[0 ], X_scale_f, X_zero_point_i32);
74+ float x = dequantize<uint8_t >(X_data[0 ], X_scale_f, X_zero_point_i32);
7775 for (size_t i = 0 ; i < Y_numel; ++i) {
78- float y =
79- kernels::dequantize<uint8_t >(Y_data[i], Y_scale_f, Y_zero_point_i32);
76+ float y = dequantize<uint8_t >(Y_data[i], Y_scale_f, Y_zero_point_i32);
8077 float z = x + y;
81- out_data[i] =
82- kernels::quantize<uint8_t >(z, inv_out_scale, out_zero_point_i32);
78+ out_data[i] = quantize<uint8_t >(z, inv_out_scale, out_zero_point_i32);
8379 }
8480 } /* other broadcasting cases */
8581 else {
@@ -162,13 +158,10 @@ void quantized_add_asym8uxasym8u_asym8u_per_tensor_out(
162158 }
163159
164160 /* Apply the operation */
165- float x = kernels::dequantize<uint8_t >(
166- X_data[X_idx], X_scale_f, X_zero_point_i32);
167- float y = kernels::dequantize<uint8_t >(
168- Y_data[Y_idx], Y_scale_f, Y_zero_point_i32);
161+ float x = dequantize<uint8_t >(X_data[X_idx], X_scale_f, X_zero_point_i32);
162+ float y = dequantize<uint8_t >(Y_data[Y_idx], Y_scale_f, Y_zero_point_i32);
169163 float z = x + y;
170- out_data[i] =
171- kernels::quantize<uint8_t >(z, inv_out_scale, out_zero_point_i32);
164+ out_data[i] = quantize<uint8_t >(z, inv_out_scale, out_zero_point_i32);
172165 }
173166 }
174167}
0 commit comments