aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/utils
diff options
context:
space:
mode:
authorManuel Bottini <manuel.bottini@arm.com>2019-05-17 14:04:22 +0100
committerManuel Bottini <manuel.bottini@arm.com>2019-05-29 14:58:16 +0000
commit5b7d537d918becb894d94d91726ce79e63d72fc1 (patch)
treee2375032d20cae479d026061a075ca63800d4532 /arm_compute/core/utils
parent088d7b4c6b9bde97b3b7f83ebce047377c810997 (diff)
downloadComputeLibrary-5b7d537d918becb894d94d91726ce79e63d72fc1.tar.gz
COMPMID-2237
Implement SPACE_TO_DEPTH for NEON Change-Id: I9f427bceca6da52671e0096be08772612f4be152 Signed-off-by: Manuel Bottini <manuel.bottini@arm.com> Reviewed-on: https://review.mlplatform.org/c/1227 Tested-by: Arm Jenkins <bsgcomp@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com>
Diffstat (limited to 'arm_compute/core/utils')
-rw-r--r--arm_compute/core/utils/misc/ShapeCalculator.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h
index 8394bbaed8..7eab17ba11 100644
--- a/arm_compute/core/utils/misc/ShapeCalculator.h
+++ b/arm_compute/core/utils/misc/ShapeCalculator.h
@@ -1058,6 +1058,29 @@ inline TensorShape compute_space_to_batch_shape(const ITensorInfo *input, const
return output_shape;
}
+/** Calculate the space to batch output shape of a tensor
+ *
+ * @param[in] input Input tensor info
+ * @param[in] block_shape Block shape value
+ *
+ * @return the calculated shape
+ */
+inline TensorShape compute_space_to_depth_shape(const ITensorInfo *input, int32_t block_shape)
+{
+ TensorShape output_shape{ input->tensor_shape() };
+
+ const DataLayout data_layout = input->data_layout();
+ const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
+ 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));
+
+ return output_shape;
+}
+
/** Calculate the prior box output shape of a tensor
*
* @param[in] input Input tensor info