aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/NEON/functions/NEReductionOperation.cpp
diff options
context:
space:
mode:
authorUsama Arif <usama.arif@arm.com>2019-05-20 12:38:33 +0100
committerUsama Arif <usama.arif@arm.com>2019-05-22 15:06:06 +0000
commita4a08ad5e33867f9938a3fbaf9b6dcc56ad8f7b5 (patch)
tree0689ecbe56aed40fd61fa250a4e8a7a98d549bc3 /src/runtime/NEON/functions/NEReductionOperation.cpp
parentb28905010a95044c7a1c0a5665fc886521a56541 (diff)
downloadComputeLibrary-a4a08ad5e33867f9938a3fbaf9b6dcc56ad8f7b5.tar.gz
COMPMID-2280: Implement REDUCE_MIN operator for NEON
Change-Id: Iaa8d97e3328ce69dae7a97a7111120ecc61fb465 Signed-off-by: Usama Arif <usama.arif@arm.com> Reviewed-on: https://review.mlplatform.org/c/1192 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Pablo Marquez <pablo.tello@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/runtime/NEON/functions/NEReductionOperation.cpp')
-rw-r--r--src/runtime/NEON/functions/NEReductionOperation.cpp47
1 files changed, 46 insertions, 1 deletions
diff --git a/src/runtime/NEON/functions/NEReductionOperation.cpp b/src/runtime/NEON/functions/NEReductionOperation.cpp
index a0aed96521..81bb32f5dc 100644
--- a/src/runtime/NEON/functions/NEReductionOperation.cpp
+++ b/src/runtime/NEON/functions/NEReductionOperation.cpp
@@ -78,7 +78,52 @@ void NEReductionOperation::configure(ITensor *input, ITensor *output, unsigned i
{
// Configure fill border kernel
const BorderSize fill_border_size = _reduction_kernel.border_size();
- const PixelValue pixelValue = (op == ReductionOperation::PROD) ? PixelValue(1, input->info()->data_type(), input->info()->quantization_info()) : PixelValue(0, input->info()->data_type());
+ PixelValue pixelValue;
+ switch(op)
+ {
+ case ReductionOperation::PROD:
+ {
+ pixelValue = PixelValue(1, input->info()->data_type(), input->info()->quantization_info());
+ break;
+ }
+ case ReductionOperation::MIN:
+ {
+ switch(input->info()->data_type())
+ {
+ case DataType::F32:
+ {
+ pixelValue = PixelValue(std::numeric_limits<float>::max());
+ break;
+ }
+ case DataType::F16:
+ {
+ pixelValue = PixelValue(static_cast<half>(65504.0f));
+ break;
+ }
+ case DataType::QASYMM8:
+ {
+ pixelValue = PixelValue(255, input->info()->data_type(), input->info()->quantization_info());
+ break;
+ }
+ default:
+ {
+ ARM_COMPUTE_ERROR("Unsupported DataType");
+ }
+ }
+ break;
+ }
+ case ReductionOperation::ARG_IDX_MAX:
+ case ReductionOperation::ARG_IDX_MIN:
+ case ReductionOperation::MEAN_SUM:
+ case ReductionOperation::SUM_SQUARE:
+ case ReductionOperation::SUM:
+ {
+ pixelValue = PixelValue(0, input->info()->data_type());
+ break;
+ }
+ default:
+ ARM_COMPUTE_ERROR("Reduction Operation unsupported");
+ }
_fill_border_kernel.configure(input, fill_border_size, BorderMode::CONSTANT, pixelValue);
}
}