diff options
author | Kevin Cheng <kevin.cheng@arm.com> | 2021-10-18 21:51:55 +0000 |
---|---|---|
committer | Kevin Cheng <kevin.cheng@arm.com> | 2021-10-28 16:51:33 +0000 |
commit | fe392ce8e714e616b5ab5b8a519d3eb84623273d (patch) | |
tree | 15b909b07cbe2b0fb435a2e0c3b513e13a8727b7 /reference_model/src/ops/ewise_binary.h | |
parent | 1009674513d09af1a699a8bf0f646c7130d7a0ac (diff) | |
download | reference_model-fe392ce8e714e616b5ab5b8a519d3eb84623273d.tar.gz |
Changes for 0.23.0 release
- update serialization_lib hash
- PAD:
1. make padding as an attribute instead of tensor.
2. add pad_const_int (for non-float type) / pad_const_fp (for float type)
- TRANSPOSE: make perm as an attribute instead of tensor
- TABLE: make table as attribute instead of tensor
- update examples/ tests
Signed-off-by: Kevin Cheng <kevin.cheng@arm.com>
Change-Id: Iddc446db4b356ba2f36ea4a79b7220b9cfc2aa4e
Diffstat (limited to 'reference_model/src/ops/ewise_binary.h')
-rw-r--r-- | reference_model/src/ops/ewise_binary.h | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/reference_model/src/ops/ewise_binary.h b/reference_model/src/ops/ewise_binary.h index fd4d408..373dfb8 100644 --- a/reference_model/src/ops/ewise_binary.h +++ b/reference_model/src/ops/ewise_binary.h @@ -184,26 +184,28 @@ public: virtual int checkTensorAttributes(); virtual int eval(); - static constexpr DType TableDtype = (InDtype == DType_INT8) ? DType_INT8 : DType_INT16; - static constexpr DType OutDtype = (InDtype == DType_INT8) ? DType_INT8 : DType_INT32; - using InEigenType = typename GetEigenType<InDtype>::type; - using TableEigenType = typename GetEigenType<TableDtype>::type; - using OutEigenType = typename GetEigenType<OutDtype>::type; - using TIn = Eigen::Tensor<InEigenType, Rank>; - using TTable = Eigen::Tensor<TableEigenType, 1>; - using TOut = Eigen::Tensor<OutEigenType, Rank>; - static constexpr int32_t IntegerBits = 9; - static constexpr int32_t FractionBits = 7; - static constexpr int32_t NumTableEntries = (1 << IntegerBits); - static constexpr int32_t QInMin = GetQMin<InDtype>::value; - static constexpr int32_t QInMax = GetQMax<InDtype>::value; - static constexpr int32_t QOutMin = GetQMin<OutDtype>::value; - static constexpr int32_t QOutMax = GetQMax<OutDtype>::value; + static constexpr DType TableDtype = (InDtype == DType_INT8) ? DType_INT8 : DType_INT16; + static constexpr DType OutDtype = (InDtype == DType_INT8) ? DType_INT8 : DType_INT32; + static constexpr uint32_t TableNumEntries = (InDtype == DType_INT8) ? 256 : 513; + using InEigenType = typename GetEigenType<InDtype>::type; + using TableEigenType = typename GetEigenType<TableDtype>::type; + using OutEigenType = typename GetEigenType<OutDtype>::type; + using TIn = Eigen::Tensor<InEigenType, Rank>; + using TTable = Eigen::Tensor<TableEigenType, 1>; + using TOut = Eigen::Tensor<OutEigenType, Rank>; + static constexpr int32_t IntegerBits = 9; + static constexpr int32_t FractionBits = 7; + static constexpr int32_t NumTableEntries = (1 << IntegerBits); + static constexpr int32_t QInMin = GetQMin<InDtype>::value; + static constexpr int32_t QInMax = GetQMax<InDtype>::value; + static constexpr int32_t QOutMin = GetQMin<OutDtype>::value; + static constexpr int32_t QOutMax = GetQMax<OutDtype>::value; protected: TosaReference::TensorTemplate<TIn>* in; - TosaReference::TensorTemplate<TTable>* table; TosaReference::TensorTemplate<TOut>* out; + TosaTableAttribute* attribute; + std::array<TableEigenType, TableNumEntries> table; }; }; // namespace TosaReference |