From b412fab0e3c8ec10e104f4d85760898a5b26179c Mon Sep 17 00:00:00 2001 From: Manuel Bottini Date: Mon, 10 Dec 2018 17:40:23 +0000 Subject: COMPMID-1724: CL Implement Prod Change-Id: I17e51f25064b53a8f7e13d6fcbecc14a192de103 Reviewed-on: https://review.mlplatform.org/387 Reviewed-by: Georgios Pinitas Tested-by: Arm Jenkins --- tests/validation/reference/ReductionOperation.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tests/validation/reference/ReductionOperation.cpp') diff --git a/tests/validation/reference/ReductionOperation.cpp b/tests/validation/reference/ReductionOperation.cpp index fc12e31d75..8e79c3bfb0 100644 --- a/tests/validation/reference/ReductionOperation.cpp +++ b/tests/validation/reference/ReductionOperation.cpp @@ -42,11 +42,11 @@ template OT reduce_operation(const T *ptr, int reduce_elements, ReductionOperation op, int stride) { using type = typename std::remove_cv::type; - auto res = type(0); + auto res = (op == ReductionOperation::PROD) ? type(1) : type(0); if(std::is_integral::value) { - uint32_t int_res = 0; + auto int_res = static_cast(res); for(int i = 0; i < reduce_elements; ++i) { auto elem = *(ptr + stride * i); @@ -72,6 +72,9 @@ OT reduce_operation(const T *ptr, int reduce_elements, ReductionOperation op, in case ReductionOperation::SUM: int_res += elem; break; + case ReductionOperation::PROD: + int_res *= elem; + break; default: ARM_COMPUTE_ERROR("Operation not supported"); } @@ -108,6 +111,9 @@ OT reduce_operation(const T *ptr, int reduce_elements, ReductionOperation op, in case ReductionOperation::SUM: res += elem; break; + case ReductionOperation::PROD: + res *= elem; + break; default: ARM_COMPUTE_ERROR("Operation not supported"); } @@ -117,7 +123,6 @@ OT reduce_operation(const T *ptr, int reduce_elements, ReductionOperation op, in res /= reduce_elements; } } - return res; } } // namespace -- cgit v1.2.1