Skip to content

Commit 5fe0f1c

Browse files
author
Zonglin Peng
committed
create quantized_linear_per_tensor_out in cpu
1 parent 250cae2 commit 5fe0f1c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

backends/cadence/reference/operators/operators.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ namespace native {
1414
namespace {
1515
using ::executorch::runtime::getLeadingDims;
1616

17+
1718
#define ET_FORALL_CADENCE_QUANTIZED_TYPES(_) \
18-
_(uint8_t, Byte) \
19+
_(uint8_t, Byte) \
1920
_(int8_t, Char)
2021

2122
inline __attribute__((always_inline)) void linear_(
@@ -37,7 +38,12 @@ inline __attribute__((always_inline)) void linear_(
3738

3839
// Given an N-dimensional input [d0, d1, d2, ..., d_{N-2}, d_{N-1}], the
3940
// leading dimensions is d0 * d1 * ... * d_{N-2}
41+
<<<<<<< HEAD
4042
int64_t leading_dims = getLeadingDims(input, input.dim() - 1);
43+
=======
44+
int64_t leading_dims =
45+
getLeadingDims(input, input.dim() - 1);
46+
>>>>>>> 5ebcf7f03 (create quantized_linear_per_tensor_out in cpu)
4147

4248
for (int i = 0; i < leading_dims; ++i) {
4349
for (int j = 0; j < M; ++j) {

backends/cadence/reference/operators/quantized_ops.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,13 @@ inline __attribute__((always_inline)) void quantized_linear_per_tensor_(
8787
(int32_t)weight_data[j * in_dim + k] - (int32_t)weight_zero_point;
8888
sum += x * w;
8989
}
90+
<<<<<<< HEAD
9091
out_data[i * out_dim + j] = ::impl::reference::kernels::quantize<T>(
9192
sum, requant_scale, out_zero_point);
93+
=======
94+
out_data[i * out_dim + j] =
95+
::impl::reference::kernels::quantize<T>(sum, requant_scale, out_zero_point);
96+
>>>>>>> 5ebcf7f03 (create quantized_linear_per_tensor_out in cpu)
9297
}
9398
}
9499
}

0 commit comments

Comments
 (0)