aboutsummaryrefslogtreecommitdiff
path: root/src/core/NEON/kernels/NEReductionOperationKernel.cpp
diff options
context:
space:
mode:
authorMichalis Spyrou <michalis.spyrou@arm.com>2020-10-06 17:44:40 +0100
committerMichalis Spyrou <michalis.spyrou@arm.com>2020-10-07 18:44:53 +0000
commit272e425d12a6f790f1807bd7ca6fe97aa6e47c93 (patch)
treeaa223dc316d3bc77d9febcc2a5886381f831cd20 /src/core/NEON/kernels/NEReductionOperationKernel.cpp
parent9bfa5d18cd0473b5e5e2e199354bd5fd81eea69c (diff)
downloadComputeLibrary-272e425d12a6f790f1807bd7ca6fe97aa6e47c93.tar.gz
COMPMID-3821: NEON Reduction op PROD failures
Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com> Change-Id: I8cfdd24c4e71a6a4be610ba67a75ad2943a43801 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4097 Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/NEON/kernels/NEReductionOperationKernel.cpp')
-rw-r--r--src/core/NEON/kernels/NEReductionOperationKernel.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/core/NEON/kernels/NEReductionOperationKernel.cpp b/src/core/NEON/kernels/NEReductionOperationKernel.cpp
index 01534f77b4..9eebb42151 100644
--- a/src/core/NEON/kernels/NEReductionOperationKernel.cpp
+++ b/src/core/NEON/kernels/NEReductionOperationKernel.cpp
@@ -1368,7 +1368,7 @@ struct RedOpYZW_quantized
// Compute left-over elements
for(; x < window_end_x; ++x)
{
- auto res_value = 0;
+ float res_value = 0.f;
switch(op)
{
case ReductionOperation::ARG_IDX_MAX:
@@ -1413,11 +1413,11 @@ struct RedOpYZW_quantized
//de-quantize input
if(std::is_same<T, uint8_t>::value)
{
- res_value *= dequantize_qasymm8(*input_ptr, iq_info);
+ res_value *= dequantize_qasymm8(*in_ptr, iq_info);
}
else
{
- res_value *= dequantize_qasymm8_signed(*input_ptr, iq_info);
+ res_value *= dequantize_qasymm8_signed(*in_ptr, iq_info);
}
break;
}
@@ -1458,8 +1458,9 @@ struct RedOpYZW_quantized
{
case ReductionOperation::MEAN_SUM:
{
- res_value /= in_info.dimension(axis);
- *reinterpret_cast<T *>(output.ptr() + x) = utils::cast::saturate_cast<T>(res_value);
+ int32_t res = static_cast<int32_t>(res_value);
+ res /= in_info.dimension(axis);
+ *reinterpret_cast<T *>(output.ptr() + x) = utils::cast::saturate_cast<T>(res);
break;
}
case ReductionOperation::SUM:
@@ -1472,16 +1473,17 @@ struct RedOpYZW_quantized
case ReductionOperation::PROD:
{
//re-quantize result
+ T res = 0;
if(std::is_same<T, uint8_t>::value)
{
- res_value = quantize_qasymm8(res_value, iq_info);
+ res = quantize_qasymm8(res_value, iq_info);
}
else
{
- res_value = quantize_qasymm8_signed(res_value, iq_info);
+ res = quantize_qasymm8_signed(res_value, iq_info);
}
+ *(reinterpret_cast<T *>(output.ptr() + x)) = res;
break;
- *(reinterpret_cast<T *>(output.ptr() + x)) = res_value;
}
case ReductionOperation::ARG_IDX_MIN:
case ReductionOperation::ARG_IDX_MAX: