aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/NEON/functions/NEReductionOperation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/NEON/functions/NEReductionOperation.cpp')
-rw-r--r--src/runtime/NEON/functions/NEReductionOperation.cpp47
1 files changed, 46 insertions, 1 deletions
diff --git a/src/runtime/NEON/functions/NEReductionOperation.cpp b/src/runtime/NEON/functions/NEReductionOperation.cpp
index a0aed96521..81bb32f5dc 100644
--- a/src/runtime/NEON/functions/NEReductionOperation.cpp
+++ b/src/runtime/NEON/functions/NEReductionOperation.cpp
@@ -78,7 +78,52 @@ void NEReductionOperation::configure(ITensor *input, ITensor *output, unsigned i
{
// Configure fill border kernel
const BorderSize fill_border_size = _reduction_kernel.border_size();
- const PixelValue pixelValue = (op == ReductionOperation::PROD) ? PixelValue(1, input->info()->data_type(), input->info()->quantization_info()) : PixelValue(0, input->info()->data_type());
+ PixelValue pixelValue;
+ switch(op)
+ {
+ case ReductionOperation::PROD:
+ {
+ pixelValue = PixelValue(1, input->info()->data_type(), input->info()->quantization_info());
+ break;
+ }
+ case 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;
+ }
+ case ReductionOperation::ARG_IDX_MAX:
+ case ReductionOperation::ARG_IDX_MIN:
+ case ReductionOperation::MEAN_SUM:
+ case ReductionOperation::SUM_SQUARE:
+ case ReductionOperation::SUM:
+ {
+ pixelValue = PixelValue(0, input->info()->data_type());
+ break;
+ }
+ default:
+ ARM_COMPUTE_ERROR("Reduction Operation unsupported");
+ }
_fill_border_kernel.configure(input, fill_border_size, BorderMode::CONSTANT, pixelValue);
}
}