aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/utils/misc
diff options
context:
space:
mode:
authorMichalis Spyrou <michalis.spyrou@arm.com>2018-09-11 11:16:47 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:54:54 +0000
commitf1addb665ad668dcd34e18c52e4961a7cf5e3886 (patch)
tree11c1b606ab26416dd0b39f1526e7eba60394e7c3 /arm_compute/core/utils/misc
parent96f6769de9d9ebe3e631b81aac9a82934a79b0c4 (diff)
downloadComputeLibrary-f1addb665ad668dcd34e18c52e4961a7cf5e3886.tar.gz
COMPMID-1549 Implementing Batch to Space on OpenCL - NHWC
Change-Id: If7ae0a8b6255a10711365068d9fb153c71f09818 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/147751 Tested-by: bsgcomp <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'arm_compute/core/utils/misc')
-rw-r--r--arm_compute/core/utils/misc/ShapeCalculator.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h
index 806149f83f..4ae97f7c1f 100644
--- a/arm_compute/core/utils/misc/ShapeCalculator.h
+++ b/arm_compute/core/utils/misc/ShapeCalculator.h
@@ -524,10 +524,16 @@ inline TensorShape compute_strided_slice_shape(const ITensorInfo &input,
inline TensorShape compute_batch_to_space_shape(const ITensorInfo *input, const int block_x, const int block_y)
{
ARM_COMPUTE_ERROR_ON(block_x <= 0 || block_y <= 0);
+
+ 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(0, input->tensor_shape()[0] * block_x);
- output_shape.set(1, input->tensor_shape()[1] * block_y);
- output_shape.set(3, input->tensor_shape()[3] / (block_x * block_y));
+ output_shape.set(idx_width, input->tensor_shape()[idx_width] * block_x);
+ output_shape.set(idx_height, input->tensor_shape()[idx_height] * block_y);
+ output_shape.set(3, input->tensor_shape()[idx_channel] / (block_x * block_y));
return output_shape;
}