diff options
author | Kevin Cheng <kevin.cheng@arm.com> | 2021-04-23 11:09:59 -0700 |
---|---|---|
committer | Kevin Cheng <kevin.cheng@arm.com> | 2021-04-23 11:09:59 -0700 |
commit | cf6224e6e8ba4fc2984de3e542538c38e27c9f57 (patch) | |
tree | 5fbb33bb2c6a842cc638028a6248ce11e9cd85ed | |
parent | 2a76ad2368f4684a8391fe69f51e52356524bf15 (diff) | |
download | reference_model-cf6224e6e8ba4fc2984de3e542538c38e27c9f57.tar.gz |
Fix bug that NegateOp doesn't clip output value
Signed-off-by: Kevin Cheng <kevin.cheng@arm.com>
Change-Id: I6b335605d79338fc77e3f84585aeffe1e61cb1f2
-rw-r--r-- | reference_model/src/ops/ewise_unary.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/reference_model/src/ops/ewise_unary.cc b/reference_model/src/ops/ewise_unary.cc index a73669c..95a1102 100644 --- a/reference_model/src/ops/ewise_unary.cc +++ b/reference_model/src/ops/ewise_unary.cc @@ -232,6 +232,7 @@ int OpNegate<Rank, Dtype>::register_fcn() ASSERT(this->qinfo); this->fcn = [this](InEigenType a) -> OutEigenType { InEigenType result = -(a - this->qinfo->input_zp()) + this->qinfo->output_zp(); + result = std::min(std::max(result, static_cast<InEigenType>(QMin)), static_cast<InEigenType>(QMax)); return result; }; break; |