diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/validation/NEON/ReductionOperation.cpp | 3 | ||||
-rw-r--r-- | tests/validation/reference/ReductionOperation.cpp | 31 |
2 files changed, 32 insertions, 2 deletions
diff --git a/tests/validation/NEON/ReductionOperation.cpp b/tests/validation/NEON/ReductionOperation.cpp index b9b4983ae6..074689d678 100644 --- a/tests/validation/NEON/ReductionOperation.cpp +++ b/tests/validation/NEON/ReductionOperation.cpp @@ -51,7 +51,8 @@ RelativeTolerance<float> tolerance_qasymm8(1); const auto ReductionOperations = framework::dataset::make("ReductionOperation", { ReductionOperation::SUM, - ReductionOperation::PROD + ReductionOperation::PROD, + ReductionOperation::MIN, }); const auto QuantizationInfos = framework::dataset::make("QuantizationInfo", diff --git a/tests/validation/reference/ReductionOperation.cpp b/tests/validation/reference/ReductionOperation.cpp index c7624a4628..1f825f0e0f 100644 --- a/tests/validation/reference/ReductionOperation.cpp +++ b/tests/validation/reference/ReductionOperation.cpp @@ -42,7 +42,24 @@ template <typename T, typename OT> OT reduce_operation(const T *ptr, int reduce_elements, ReductionOperation op, int stride) { using type = typename std::remove_cv<OT>::type; - auto res = (op == ReductionOperation::PROD) ? type(1) : type(0); + T res; + switch(op) + { + case ReductionOperation::PROD: + { + res = type(1); + } + break; + case ReductionOperation::MIN: + { + res = *ptr; + } + break; + default: + { + res = type(0); + } + } if(std::is_integral<type>::value) { @@ -65,6 +82,12 @@ OT reduce_operation(const T *ptr, int reduce_elements, ReductionOperation op, in int_res = static_cast<uint32_t>(i); } break; + case ReductionOperation::MIN: + if(static_cast<T>(int_res) > elem) + { + int_res = elem; + } + break; case ReductionOperation::SUM_SQUARE: int_res += elem * elem; break; @@ -104,6 +127,12 @@ OT reduce_operation(const T *ptr, int reduce_elements, ReductionOperation op, in res = static_cast<uint32_t>(i); } break; + case ReductionOperation::MIN: + if(res > elem) + { + res = elem; + } + break; case ReductionOperation::SUM_SQUARE: res += elem * elem; break; |