aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL/functions/CLReductionOperation.cpp
diff options
context:
space:
mode:
authorUsama Arif <usama.arif@arm.com>2019-05-21 11:48:37 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2019-05-22 14:11:15 +0000
commitb28905010a95044c7a1c0a5665fc886521a56541 (patch)
treed087e866c8f1acdc15eec89e74091b1858edaa13 /src/runtime/CL/functions/CLReductionOperation.cpp
parent725b173d620726015cfebfd28356c1c1fa6e80b9 (diff)
downloadComputeLibrary-b28905010a95044c7a1c0a5665fc886521a56541.tar.gz
COMPMID-2281: Implement REDUCE_MIN operator for CL
Change-Id: I60fd3affad0ab5a2f1cef18aaa46dc2dc448caeb Signed-off-by: Usama Arif <usama.arif@arm.com> Reviewed-on: https://review.mlplatform.org/c/1194 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Pablo Marquez <pablo.tello@arm.com> Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/runtime/CL/functions/CLReductionOperation.cpp')
-rw-r--r--src/runtime/CL/functions/CLReductionOperation.cpp32
1 files changed, 32 insertions, 0 deletions
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<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;
default:
ARM_COMPUTE_ERROR("Not supported");
}