From 048b0f300ee729cac1b3019311589c654771fb8f Mon Sep 17 00:00:00 2001 From: Usama Arif Date: Wed, 22 May 2019 16:32:27 +0100 Subject: COMPMID-2278: Implement REDUCE_MAX operator for CL. Change-Id: Ie23e3ddc45d6f5506a63f935758a215ba7412bf5 Signed-off-by: Usama Arif Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/186031 Tested-by: bsgcomp Reviewed-by: Georgios Pinitas Comments-Addressed: bsgcomp Reviewed-on: https://review.mlplatform.org/c/1214 Tested-by: Arm Jenkins Comments-Addressed: 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 2e48897323..38f0a7523c 100644 --- a/src/runtime/CL/functions/CLReductionOperation.cpp +++ b/src/runtime/CL/functions/CLReductionOperation.cpp @@ -110,6 +110,11 @@ Status CLReductionOperation::validate(const ITensorInfo *input, const ITensorInf intermediate_kernel_op = ReductionOperation::MIN; last_kernel_op = ReductionOperation::MIN; break; + case ReductionOperation::MAX: + first_kernel_op = ReductionOperation::MAX; + intermediate_kernel_op = ReductionOperation::MAX; + last_kernel_op = ReductionOperation::MAX; + break; default: ARM_COMPUTE_ERROR("Not supported"); } @@ -211,6 +216,33 @@ void CLReductionOperation::configure(ICLTensor *input, ICLTensor *output, unsign } } break; + case ReductionOperation::MAX: + first_kernel_op = ReductionOperation::MAX; + intermediate_kernel_op = ReductionOperation::MAX; + last_kernel_op = ReductionOperation::MAX; + 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(0, 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