aboutsummaryrefslogtreecommitdiff
path: root/reference_model/src/ops/ewise_binary.cc
diff options
context:
space:
mode:
authorJeremy Johnson <jeremy.johnson@arm.com>2023-11-07 16:27:35 +0000
committerEric Kunze <eric.kunze@arm.com>2023-11-16 21:24:23 +0000
commit9a758384d1066ade713311940f3d15c860f90866 (patch)
treec25c9624b7c1d589d0648d6b3b4e6333f87a7712 /reference_model/src/ops/ewise_binary.cc
parent2d70ac4c02808609feb357488dcd080bd6fc5ba5 (diff)
downloadreference_model-9a758384d1066ade713311940f3d15c860f90866.tar.gz
Main Compliance testing support for EXP & POW
Added new ABS_ERROR mode to verify lib and ref model. Signed-off-by: Jeremy Johnson <jeremy.johnson@arm.com> Change-Id: Ifb78290675833d3df7df91a4d6cef336b02b64a4
Diffstat (limited to 'reference_model/src/ops/ewise_binary.cc')
-rw-r--r--reference_model/src/ops/ewise_binary.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/reference_model/src/ops/ewise_binary.cc b/reference_model/src/ops/ewise_binary.cc
index be621cb..fab221d 100644
--- a/reference_model/src/ops/ewise_binary.cc
+++ b/reference_model/src/ops/ewise_binary.cc
@@ -514,7 +514,18 @@ int OpPow<Rank, Dtype>::register_fcn()
this->fcn = [](InEigenType a, InEigenType b) -> OutEigenType { return fpTrunc<OutDtype>(powf(a, b)); };
break;
case TOSA_REF_TYPE_FP64:
- this->fcn = [](InEigenType a, InEigenType b) -> OutEigenType { return pow(a, b); };
+ if (g_func_config.abs_mode)
+ {
+ // ABS_ERROR bounds return (1+abs(log(abs(a))*b))
+ this->fcn = [](InEigenType a, InEigenType b) -> OutEigenType {
+ OutEigenType c = log(a > (InEigenType)0 ? a : (-a)) * b;
+ return 1.0 + (c > (OutEigenType)0 ? c : (-c));
+ };
+ }
+ else
+ {
+ this->fcn = [](InEigenType a, InEigenType b) -> OutEigenType { return pow(a, b); };
+ }
break;
default:
ERROR_IF(true, "unsupported TOSA_REF_TYPE %s", EnumNameTOSAREFTYPE(Dtype));