aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arm_compute/core/utils/misc/ShapeCalculator.h6
-rw-r--r--tests/validation/fixtures/SpaceToDepthFixture.h7
2 files changed, 10 insertions, 3 deletions
diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h
index 9f9f53ed8b..84c0ee5034 100644
--- a/arm_compute/core/utils/misc/ShapeCalculator.h
+++ b/arm_compute/core/utils/misc/ShapeCalculator.h
@@ -1168,9 +1168,9 @@ inline TensorShape compute_space_to_depth_shape(const ITensorInfo *input, int32_
const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
const int idx_depth = get_data_layout_dimension_index(data_layout, DataLayoutDimension::CHANNEL);
- output_shape.set(idx_width, input->tensor_shape()[idx_width] * block_shape);
- output_shape.set(idx_height, input->tensor_shape()[idx_height] * block_shape);
- output_shape.set(idx_depth, input->tensor_shape()[idx_depth] / (block_shape * block_shape));
+ output_shape.set(idx_width, input->tensor_shape()[idx_width] / block_shape);
+ output_shape.set(idx_height, input->tensor_shape()[idx_height] / block_shape);
+ output_shape.set(idx_depth, input->tensor_shape()[idx_depth] * (block_shape * block_shape));
return output_shape;
}
diff --git a/tests/validation/fixtures/SpaceToDepthFixture.h b/tests/validation/fixtures/SpaceToDepthFixture.h
index 7448ec546b..0776e495eb 100644
--- a/tests/validation/fixtures/SpaceToDepthFixture.h
+++ b/tests/validation/fixtures/SpaceToDepthFixture.h
@@ -24,6 +24,7 @@
#ifndef ARM_COMPUTE_TEST_SPACE_TO_DEPTH_LAYER_FIXTURE
#define ARM_COMPUTE_TEST_SPACE_TO_DEPTH_LAYER_FIXTURE
+#include "arm_compute/core/utils/misc/ShapeCalculator.h"
#include "tests/Globals.h"
#include "tests/framework/Asserts.h"
#include "tests/framework/Fixture.h"
@@ -69,6 +70,12 @@ protected:
TensorType input = create_tensor<TensorType>(input_shape, data_type, 1, QuantizationInfo(), data_layout);
TensorType output = create_tensor<TensorType>(output_shape, data_type, 1, QuantizationInfo(), data_layout);
+ auto calc_out_shape = misc::shape_calculator::compute_space_to_depth_shape(input.info(), block_shape);
+ ARM_COMPUTE_ASSERT(output_shape[0] == calc_out_shape[0]);
+ ARM_COMPUTE_ASSERT(output_shape[1] == calc_out_shape[1]);
+ ARM_COMPUTE_ASSERT(output_shape[2] == calc_out_shape[2]);
+ ARM_COMPUTE_ASSERT(output_shape[3] == calc_out_shape[3]);
+
// Create and configure function
FunctionType space_to_depth;
space_to_depth.configure(&input, &output, block_shape);