aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/utils
diff options
context:
space:
mode:
authorMichalis Spyrou <michalis.spyrou@arm.com>2019-05-21 13:30:10 +0100
committerMichalis Spyrou <michalis.spyrou@arm.com>2019-05-24 11:55:44 +0000
commit22f917cfd2282052c447068b188eee0c59f737fd (patch)
tree649e16f34ad59cd6d83eb65412003a24d788dea8 /arm_compute/core/utils
parent1e6e1b899c1a88d3466cdc6fd097ccf32ff767e3 (diff)
downloadComputeLibrary-22f917cfd2282052c447068b188eee0c59f737fd.tar.gz
COMPMID-2240 Implement DEPTH_TO_SPACE for NEON
Change-Id: I705aa0f804093c3628c691e46cca475f2819dc65 Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com> Reviewed-on: https://review.mlplatform.org/c/1198 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Giuseppe Rossini <giuseppe.rossini@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core/utils')
-rw-r--r--arm_compute/core/utils/misc/ShapeCalculator.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h
index d66c87fb42..8394bbaed8 100644
--- a/arm_compute/core/utils/misc/ShapeCalculator.h
+++ b/arm_compute/core/utils/misc/ShapeCalculator.h
@@ -975,6 +975,30 @@ inline TensorShape compute_batch_to_space_shape(const ITensorInfo *input, const
return output_shape;
}
+/** Calculate the depth to space output shape of a tensor
+ *
+ * @param[in] input Input tensor info
+ * @param[in] block Block shape value
+ *
+ * @return the calculated shape
+ */
+inline TensorShape compute_depth_to_space_shape(const ITensorInfo *input, int block)
+{
+ ARM_COMPUTE_ERROR_ON(block < 2);
+
+ 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_channel = get_data_layout_dimension_index(data_layout, DataLayoutDimension::CHANNEL);
+
+ TensorShape output_shape{ input->tensor_shape() };
+ output_shape.set(idx_width, input->dimension(idx_width) * block);
+ output_shape.set(idx_height, input->dimension(idx_height) * block);
+ output_shape.set(idx_channel, input->dimension(idx_channel) / (block * block));
+
+ return output_shape;
+}
+
/** Calculate the split output shape of a tensor
*
* @param[in] input Input tensor info