From b28905010a95044c7a1c0a5665fc886521a56541 Mon Sep 17 00:00:00 2001 From: Usama Arif Date: Tue, 21 May 2019 11:48:37 +0100 Subject: COMPMID-2281: Implement REDUCE_MIN operator for CL Change-Id: I60fd3affad0ab5a2f1cef18aaa46dc2dc448caeb Signed-off-by: Usama Arif Reviewed-on: https://review.mlplatform.org/c/1194 Comments-Addressed: Arm Jenkins Reviewed-by: Pablo Marquez Reviewed-by: Michalis Spyrou Tested-by: Arm Jenkins --- src/runtime/CL/functions/CLReductionOperation.cpp | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/runtime/CL/functions/CLReductionOperation.cpp') diff --git a/src/runtime/CL/functions/CLReductionOperation.cpp b/src/runtime/CL/functions/CLReductionOperation.cpp index 9f99d2db6f..2e48897323 100644 --- a/src/runtime/CL/functions/CLReductionOperation.cpp +++ b/src/runtime/CL/functions/CLReductionOperation.cpp @@ -105,6 +105,11 @@ Status CLReductionOperation::validate(const ITensorInfo *input, const ITensorInf intermediate_kernel_op = ReductionOperation::PROD; last_kernel_op = ReductionOperation::PROD; break; + case ReductionOperation::MIN: + first_kernel_op = ReductionOperation::MIN; + intermediate_kernel_op = ReductionOperation::MIN; + last_kernel_op = ReductionOperation::MIN; + break; default: ARM_COMPUTE_ERROR("Not supported"); } @@ -179,6 +184,33 @@ void CLReductionOperation::configure(ICLTensor *input, ICLTensor *output, unsign last_kernel_op = ReductionOperation::PROD; pixelValue = PixelValue(1, input->info()->data_type()); break; + case ReductionOperation::MIN: + first_kernel_op = ReductionOperation::MIN; + intermediate_kernel_op = ReductionOperation::MIN; + last_kernel_op = 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; default: ARM_COMPUTE_ERROR("Not supported"); } -- cgit v1.2.1