diff options
author | Kevin Cheng <kevin.cheng@arm.com> | 2021-05-12 10:44:49 -0700 |
---|---|---|
committer | Kevin Cheng <kevin.cheng@arm.com> | 2021-05-12 14:51:16 -0700 |
commit | 14d7f7a2b5d0d85b83d8c84a5456828feb1a0ea1 (patch) | |
tree | c0e5eaa7e119d7998f5780a6c90947e875eddf84 /reference_model/src/ops/ewise_binary.cc | |
parent | d267dd9418374d49ac1e1a1a9c9b1d30b5733ee9 (diff) | |
download | reference_model-14d7f7a2b5d0d85b83d8c84a5456828feb1a0ea1.tar.gz |
Update to v0.22.0
- remove identityN and placeholder
- add div
- update serialization_lib hash
- update apply_scale_16() assertion
- regenerate examples/ due to serialization_lib change
Change-Id: I7183d92bec33697c65adfc07cb8eb89c6882675a
Diffstat (limited to 'reference_model/src/ops/ewise_binary.cc')
-rw-r--r-- | reference_model/src/ops/ewise_binary.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/reference_model/src/ops/ewise_binary.cc b/reference_model/src/ops/ewise_binary.cc index fc587f1..76cebeb 100644 --- a/reference_model/src/ops/ewise_binary.cc +++ b/reference_model/src/ops/ewise_binary.cc @@ -298,6 +298,27 @@ int OpBitwiseXor<Rank, Dtype>::register_fcn() } template <int Rank, DType Dtype> +int OpDiv<Rank, Dtype>::register_fcn() +{ + switch (InDtype) + { + case DType_INT32: + this->fcn = [this](InEigenType a, InEigenType b) -> OutEigenType { + ASSERT_MSG_NODE(b != 0, "OpDiv: divisor must be non-zero value"); + int64_t res_in_64 = static_cast<int64_t>(a) / b; + int64_t i32_max_in_64 = static_cast<int64_t>(std::numeric_limits<InEigenType>::max()); + ASSERT_MSG_NODE(a <= i32_max_in_64, "OpDiv: result not in i32 range"); + return static_cast<InEigenType>(res_in_64); + }; + break; + default: + FATAL_ERROR_NODE("unsupported DType %s", EnumNamesDType()[InDtype]); + } + + return 0; +} + +template <int Rank, DType Dtype> int OpLogicalAnd<Rank, Dtype>::register_fcn() { switch (Dtype) @@ -579,6 +600,8 @@ DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpBitwiseXor, INT8); DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpBitwiseXor, INT16); DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpBitwiseXor, INT32); +DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpDiv, INT32); + DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpLogicalAnd, BOOL); DEF_INSTANTIATE_RANK0_6_ONE_RANK_ONE_TYPE(OpLogicalLeftShift, INT8); |