From b70770ee65ccce71a74e73df55fcaeac3cb9d0d7 Mon Sep 17 00:00:00 2001 From: Michele Di Giorgio Date: Wed, 22 Apr 2020 12:26:10 +0100 Subject: COMPMID-3069: Requantize in int32_t in RELUs of NEActivationLayerKernel Requantization must be in 32 bits as there is a multiplication by scaling factor and an offset addition. In this case, clamp was interpreting the input as an 8-bit value, therefore cutting the remaining 24 bits. Change-Id: I31a5837a94e229201a023b1617fc2df5c35f61e3 Signed-off-by: Michele Di Giorgio Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3076 Reviewed-by: Michalis Spyrou Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- src/core/NEON/kernels/NEActivationLayerKernel.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/NEON/kernels/NEActivationLayerKernel.cpp b/src/core/NEON/kernels/NEActivationLayerKernel.cpp index a1652447f4..8e91e6b4d1 100644 --- a/src/core/NEON/kernels/NEActivationLayerKernel.cpp +++ b/src/core/NEON/kernels/NEActivationLayerKernel.cpp @@ -533,17 +533,17 @@ typename std::enable_if::value, void>::type NEActivat if(act == ActivationFunction::RELU) { tmp = std::max(const_0, in); - tmp = utility::clamp(tmp * s + o); + tmp = utility::clamp(tmp * s + o); } else if(act == ActivationFunction::BOUNDED_RELU) { tmp = std::min(a, std::max(const_0, in)); - tmp = utility::clamp(tmp * s + o); + tmp = utility::clamp(tmp * s + o); } else if(act == ActivationFunction::LU_BOUNDED_RELU) { tmp = std::min(a, std::max(b, in)); - tmp = utility::clamp(tmp * s + o); + tmp = utility::clamp(tmp * s + o); } else if(act == ActivationFunction::LOGISTIC) { @@ -710,17 +710,17 @@ typename std::enable_if::value, void>::type NE if(act == ActivationFunction::RELU) { tmp = std::max(const_0, in); - tmp = utility::clamp(tmp * s + o); + tmp = utility::clamp(tmp * s + o); } else if(act == ActivationFunction::BOUNDED_RELU) { tmp = std::min(a, std::max(const_0, in)); - tmp = utility::clamp(tmp * s + o); + tmp = utility::clamp(tmp * s + o); } else if(act == ActivationFunction::LU_BOUNDED_RELU) { tmp = std::min(a, std::max(b, in)); - tmp = utility::clamp(tmp * s + o); + tmp = utility::clamp(tmp * s + o); } else if(act == ActivationFunction::LOGISTIC) { -- cgit v1.2.1