diff options
author | Pablo Tello <pablo.tello@arm.com> | 2019-12-11 13:04:34 +0000 |
---|---|---|
committer | Georgios Pinitas <georgios.pinitas@arm.com> | 2019-12-11 18:24:53 +0000 |
commit | a0a4ba1285b47fb61295977bc43af34f7f692264 (patch) | |
tree | 5668852fd57f543dc805f814200d2b0087f2493a /src/runtime/NEON | |
parent | af486c11dd122a3bb9af8a835b46e4ea94b90eb3 (diff) | |
download | ComputeLibrary-a0a4ba1285b47fb61295977bc43af34f7f692264.tar.gz |
COMPMID-2855: CLReduceMean throws error for invalid configs
Change-Id: Icc198a6db7dc79230972e12f226fa6fa1d9de6cb
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>
Diffstat (limited to 'src/runtime/NEON')
-rw-r--r-- | src/runtime/NEON/functions/NEReduceMean.cpp | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/src/runtime/NEON/functions/NEReduceMean.cpp b/src/runtime/NEON/functions/NEReduceMean.cpp index 10437f51bc..72c63a8e30 100644 --- a/src/runtime/NEON/functions/NEReduceMean.cpp +++ b/src/runtime/NEON/functions/NEReduceMean.cpp @@ -26,40 +26,13 @@ #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" namespace arm_compute { namespace { -inline TensorShape calculate_reduce_mean_shape(ITensor *input, const Coordinates &reduction_axis, bool keep_dims) -{ - const int reduction_ops = reduction_axis.num_dimensions(); - Coordinates axis_local = reduction_axis; - const int input_dims = input->info()->num_dimensions(); - convert_negative_axis(axis_local, input_dims); - TensorShape out_shape = input->info()->tensor_shape(); - // Configure reshape layer if we want to drop the dimensions - if(!keep_dims) - { - // We have to sort the reduction axis vectors in order for remove_dimension - // to work properly - std::sort(axis_local.begin(), axis_local.begin() + reduction_ops); - for(int i = 0; i < reduction_ops; ++i) - { - out_shape.remove_dimension(axis_local[i] - i); - } - return out_shape; - } - else - { - for(int i = 0; i < reduction_ops; ++i) - { - out_shape.set(axis_local[i], 1); - } - return out_shape; - } -} } // namespace NEReduceMean::NEReduceMean(std::shared_ptr<IMemoryManager> memory_manager) @@ -130,7 +103,7 @@ void NEReduceMean::configure(ITensor *input, const Coordinates &reduction_axis, // 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 = calculate_reduce_mean_shape(input, reduction_axis, keep_dims); + 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(); |