aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL/functions/CLReductionOperation.cpp
diff options
context:
space:
mode:
authorUsama Arif <usama.arif@arm.com>2019-05-22 16:32:27 +0100
committerUsama Arif <usama.arif@arm.com>2019-05-24 09:20:23 +0000
commit048b0f300ee729cac1b3019311589c654771fb8f (patch)
treecbf5f8cb2baee37292bc4dfe5ab218e40a464b54 /src/runtime/CL/functions/CLReductionOperation.cpp
parent9e631c204444e7b095510c54819e944f9be8d342 (diff)
downloadComputeLibrary-048b0f300ee729cac1b3019311589c654771fb8f.tar.gz
COMPMID-2278: Implement REDUCE_MAX operator for CL.
Change-Id: Ie23e3ddc45d6f5506a63f935758a215ba7412bf5 Signed-off-by: Usama Arif <usama.arif@arm.com> Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/186031 Tested-by: bsgcomp <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Comments-Addressed: bsgcomp <bsgcomp@arm.com> Reviewed-on: https://review.mlplatform.org/c/1214 Tested-by: Arm Jenkins <bsgcomp@arm.com> Comments-Addressed: 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 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<float>::max());
+ break;
+ }
+ case DataType::F16:
+ {
+ pixelValue = PixelValue(static_cast<half>(-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");
}