From a4a08ad5e33867f9938a3fbaf9b6dcc56ad8f7b5 Mon Sep 17 00:00:00 2001 From: Usama Arif Date: Mon, 20 May 2019 12:38:33 +0100 Subject: COMPMID-2280: Implement REDUCE_MIN operator for NEON Change-Id: Iaa8d97e3328ce69dae7a97a7111120ecc61fb465 Signed-off-by: Usama Arif Reviewed-on: https://review.mlplatform.org/c/1192 Comments-Addressed: Arm Jenkins Reviewed-by: Pablo Marquez Tested-by: Arm Jenkins --- .../NEON/functions/NEReductionOperation.cpp | 47 +++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'src/runtime/NEON/functions/NEReductionOperation.cpp') 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::max()); + break; + } + case DataType::F16: + { + pixelValue = PixelValue(static_cast(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); } } -- cgit v1.2.1