aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@arm.com>2020-04-22 12:26:10 +0100
committerMichele Di Giorgio <michele.digiorgio@arm.com>2020-04-22 16:16:28 +0000
commitb70770ee65ccce71a74e73df55fcaeac3cb9d0d7 (patch)
treebfcaf0aef6e1f9a3addb4be161a423c17f523138
parent2803f703fe149f8a04c96d484266b7401e1ad355 (diff)
downloadComputeLibrary-b70770ee65ccce71a74e73df55fcaeac3cb9d0d7.tar.gz
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 <michele.digiorgio@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3076 Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--src/core/NEON/kernels/NEActivationLayerKernel.cpp12
1 files 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<std::is_same<T, qasymm8_t>::value, void>::type NEActivat
if(act == ActivationFunction::RELU)
{
tmp = std::max(const_0, in);
- tmp = utility::clamp<qasymm8_t>(tmp * s + o);
+ tmp = utility::clamp<int32_t, qasymm8_t>(tmp * s + o);
}
else if(act == ActivationFunction::BOUNDED_RELU)
{
tmp = std::min(a, std::max(const_0, in));
- tmp = utility::clamp<qasymm8_t>(tmp * s + o);
+ tmp = utility::clamp<int32_t, qasymm8_t>(tmp * s + o);
}
else if(act == ActivationFunction::LU_BOUNDED_RELU)
{
tmp = std::min(a, std::max(b, in));
- tmp = utility::clamp<qasymm8_t>(tmp * s + o);
+ tmp = utility::clamp<int32_t, qasymm8_t>(tmp * s + o);
}
else if(act == ActivationFunction::LOGISTIC)
{
@@ -710,17 +710,17 @@ typename std::enable_if<std::is_same<T, qasymm8_signed_t>::value, void>::type NE
if(act == ActivationFunction::RELU)
{
tmp = std::max(const_0, in);
- tmp = utility::clamp<qasymm8_signed_t>(tmp * s + o);
+ tmp = utility::clamp<int32_t, qasymm8_signed_t>(tmp * s + o);
}
else if(act == ActivationFunction::BOUNDED_RELU)
{
tmp = std::min(a, std::max(const_0, in));
- tmp = utility::clamp<qasymm8_signed_t>(tmp * s + o);
+ tmp = utility::clamp<int32_t, qasymm8_signed_t>(tmp * s + o);
}
else if(act == ActivationFunction::LU_BOUNDED_RELU)
{
tmp = std::min(a, std::max(b, in));
- tmp = utility::clamp<qasymm8_signed_t>(tmp * s + o);
+ tmp = utility::clamp<int32_t, qasymm8_signed_t>(tmp * s + o);
}
else if(act == ActivationFunction::LOGISTIC)
{