diff options
author | Jerry Ge <jerry.ge@arm.com> | 2023-07-19 23:08:16 +0000 |
---|---|---|
committer | Jerry Ge <jerry.ge@arm.com> | 2023-07-25 22:49:17 +0000 |
commit | 9c9c8dafe8f9a32bd70aee268cd537b93865a3ba (patch) | |
tree | e94fc471261b9f72bef86033fbc76022f55d5de8 /reference_model/src/ops/activation_funcs.cc | |
parent | c1e13432b4a218781afd6b0171d4afff11730433 (diff) | |
download | reference_model-9c9c8dafe8f9a32bd70aee268cd537b93865a3ba.tar.gz |
Run clang-format and update copyright
- Also added run clang-format to pre-commit runs
Signed-off-by: Jerry Ge <jerry.ge@arm.com>
Change-Id: I4e59ac0afbaa30dce0773aa63d92a1a3b119e2f3
Diffstat (limited to 'reference_model/src/ops/activation_funcs.cc')
-rw-r--r-- | reference_model/src/ops/activation_funcs.cc | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/reference_model/src/ops/activation_funcs.cc b/reference_model/src/ops/activation_funcs.cc index 12d0697..8ca77f7 100644 --- a/reference_model/src/ops/activation_funcs.cc +++ b/reference_model/src/ops/activation_funcs.cc @@ -14,9 +14,9 @@ // limitations under the License. #include "activation_funcs.h" +#include "arith_util.h" #include "quant_util.h" #include "template_types.h" -#include "arith_util.h" #include <cmath> using namespace TosaReference; @@ -34,17 +34,17 @@ int OpClamp<Rank, Dtype>::register_fcn() { case TOSA_REF_TYPE_FP16: case TOSA_REF_TYPE_BF16: - case TOSA_REF_TYPE_FP32: - { + case TOSA_REF_TYPE_FP32: { InEigenType min = (InEigenType)attribute->min_fp(); InEigenType max = (InEigenType)attribute->max_fp(); ERROR_IF(max < min, "OpClamp: max smaller than min"); - this->fcn = [min, max](InEigenType a) -> OutEigenType { return fpTrunc<Dtype>(a <= min ? min : a >= max ? max : a); }; + this->fcn = [min, max](InEigenType a) -> OutEigenType { + return fpTrunc<Dtype>(a <= min ? min : a >= max ? max : a); + }; } break; - case TOSA_REF_TYPE_FP64: - { + case TOSA_REF_TYPE_FP64: { InEigenType min = (InEigenType)attribute->min_fp(); InEigenType max = (InEigenType)attribute->max_fp(); ERROR_IF(max < min, "OpClamp: max smaller than min"); @@ -53,8 +53,7 @@ int OpClamp<Rank, Dtype>::register_fcn() } break; case TOSA_REF_TYPE_INT8: - case TOSA_REF_TYPE_INT16: - { + case TOSA_REF_TYPE_INT16: { InEigenType min = (InEigenType)attribute->min_int(); InEigenType max = (InEigenType)attribute->max_int(); ERROR_IF(max < min, "OpClamp: max smaller than min"); @@ -71,7 +70,8 @@ int OpClamp<Rank, Dtype>::register_fcn() template <int Rank, TOSA_REF_TYPE Dtype> OpClamp<Rank, Dtype>::~OpClamp() { - if (attribute) delete attribute; + if (attribute) + delete attribute; } template <int Rank, TOSA_REF_TYPE Dtype> @@ -86,9 +86,7 @@ int OpSigmoid<Rank, Dtype>::register_fcn() case TOSA_REF_TYPE_FP16: case TOSA_REF_TYPE_BF16: case TOSA_REF_TYPE_FP32: - this->fcn = [](InEigenType a) -> OutEigenType { - return fpTrunc<Dtype>(1.f / (1.f + (expf(-1.f * a)))); - }; + this->fcn = [](InEigenType a) -> OutEigenType { return fpTrunc<Dtype>(1.f / (1.f + (expf(-1.f * a)))); }; break; case TOSA_REF_TYPE_FP64: this->fcn = [](InEigenType a) -> OutEigenType { return (1.L / (1.L + (exp(-1.L * a)))); }; |