aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/NEON/functions/NEReduceMean.cpp
diff options
context:
space:
mode:
authorPablo Tello <pablo.tello@arm.com>2019-12-11 13:04:34 +0000
committerSiCongLi <sicong.li@arm.com>2019-12-11 19:18:07 +0000
commit99d619561755a74f205188c1857de0ec3406c34c (patch)
tree58057b319f70b24ecd9be366028d255e1bc26357 /src/runtime/NEON/functions/NEReduceMean.cpp
parent6f58d1ec864b9a4960181ceeab177cd0db54e2e1 (diff)
downloadComputeLibrary-99d619561755a74f205188c1857de0ec3406c34c.tar.gz
COMPMID-2855: CLReduceMean throws error for invalid configs
Signed-off-by: Pablo Tello <pablo.tello@arm.com> Reviewed-on: https://review.mlplatform.org/c/2452 Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Change-Id: I7cda1b67aa6c3541fdd7781be12288c8fc36ffeb
Diffstat (limited to 'src/runtime/NEON/functions/NEReduceMean.cpp')
-rw-r--r--src/runtime/NEON/functions/NEReduceMean.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/runtime/NEON/functions/NEReduceMean.cpp b/src/runtime/NEON/functions/NEReduceMean.cpp
index 4547a1f9b0..96ec8b8587 100644
--- a/src/runtime/NEON/functions/NEReduceMean.cpp
+++ b/src/runtime/NEON/functions/NEReduceMean.cpp
@@ -26,9 +26,11 @@
#include "arm_compute/core/CPP/Validate.h"
#include "arm_compute/core/Error.h"
#include "arm_compute/core/Helpers.h"
+#include "arm_compute/core/utils/misc/ShapeCalculator.h"
#include "arm_compute/runtime/NEON/NEScheduler.h"
-using namespace arm_compute;
+namespace arm_compute
+{
NEReduceMean::NEReduceMean(std::shared_ptr<IMemoryManager> memory_manager)
: _memory_group(std::move(memory_manager)), _reduction_kernels(), _reduced_outs(), _reshape(), _reduction_ops(), _keep_dims()
@@ -95,7 +97,11 @@ Status NEReduceMean::validate(const ITensorInfo *input, const Coordinates &reduc
void NEReduceMean::configure(ITensor *input, const Coordinates &reduction_axis, bool keep_dims, ITensor *output)
{
- ARM_COMPUTE_ERROR_ON_NULLPTR(input);
+ // Perform validate step
+ ARM_COMPUTE_ERROR_THROW_ON(NEReduceMean::validate(input->info(), reduction_axis, keep_dims, output->info()));
+ // Output auto inizialitation if not yet initialized
+ const TensorShape output_shape = arm_compute::misc::shape_calculator::calculate_reduce_mean_shape(input, reduction_axis, keep_dims);
+ auto_init_if_empty(*output->info(), input->info()->clone()->set_tensor_shape(output_shape));
_reduction_ops = reduction_axis.num_dimensions();
_reduction_kernels.resize(_reduction_ops);
@@ -161,3 +167,5 @@ void NEReduceMean::run()
_reshape.run();
}
}
+
+} // namespace arm_compute