aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@arm.com>2020-04-20 17:39:33 +0100
committerMichele Di Giorgio <michele.digiorgio@arm.com>2020-04-21 13:49:49 +0000
commit7ba240bb54bdbd50f1809f944dde2fac7005cc10 (patch)
treed5b9fbe667247c75cb30c65f1d77cc6fc5e8241e
parent1c1b3aa470f3854000be22edb61991f6210e5605 (diff)
downloadComputeLibrary-7ba240bb54bdbd50f1809f944dde2fac7005cc10.tar.gz
COMPMID-3069: Fix QASYMM8_SIGNED RELUs in NEActivationLayerKernel
Wrong boundaries were used for clamping the output when data type was QASYMM8_SIGNED. Change-Id: Ie93bf64643fce95be2b4a5a63ef2d1dc83bbdd97 Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3064 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Comments-Addressed: 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 5251209463..a1652447f4 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 = std::max<int32_t>(0, std::min<int32_t>(tmp * s + o, 255));
+ tmp = utility::clamp<qasymm8_t>(tmp * s + o);
}
else if(act == ActivationFunction::BOUNDED_RELU)
{
tmp = std::min(a, std::max(const_0, in));
- tmp = std::max<int32_t>(0, std::min<int32_t>(tmp * s + o, 255));
+ tmp = utility::clamp<qasymm8_t>(tmp * s + o);
}
else if(act == ActivationFunction::LU_BOUNDED_RELU)
{
tmp = std::min(a, std::max(b, in));
- tmp = std::max<int32_t>(0, std::min<int32_t>(tmp * s + o, 255));
+ tmp = utility::clamp<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 = std::max<int32_t>(0, std::min<int32_t>(tmp * s + o, 255));
+ tmp = utility::clamp<qasymm8_signed_t>(tmp * s + o);
}
else if(act == ActivationFunction::BOUNDED_RELU)
{
tmp = std::min(a, std::max(const_0, in));
- tmp = std::max<int32_t>(0, std::min<int32_t>(tmp * s + o, 255));
+ tmp = utility::clamp<qasymm8_signed_t>(tmp * s + o);
}
else if(act == ActivationFunction::LU_BOUNDED_RELU)
{
tmp = std::min(a, std::max(b, in));
- tmp = std::max<int32_t>(0, std::min<int32_t>(tmp * s + o, 255));
+ tmp = utility::clamp<qasymm8_signed_t>(tmp * s + o);
}
else if(act == ActivationFunction::LOGISTIC)
{