diff options
author | Michalis Spyrou <michalis.spyrou@arm.com> | 2018-09-18 13:09:30 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:54:54 +0000 |
commit | 13a51e11680aa24a9b841a4afe4079419bc8b80c (patch) | |
tree | ae9125b2e791d41fa4e2f8d9527ad3b9259eede0 /arm_compute/core/utils | |
parent | a799ce0ad775829862891dd98d1232638ec8761e (diff) | |
download | ComputeLibrary-13a51e11680aa24a9b841a4afe4079419bc8b80c.tar.gz |
COMPMID-1554 Implementing Space to Batch on OpenCL - NHWC
Change-Id: Ifa37a6758f79d0a6ca771dcfb4c55a5d96b452d0
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/148892
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Tested-by: bsgcomp <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core/utils')
-rw-r--r-- | arm_compute/core/utils/misc/ShapeCalculator.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h index 2db7b28161..e88fd8d75e 100644 --- a/arm_compute/core/utils/misc/ShapeCalculator.h +++ b/arm_compute/core/utils/misc/ShapeCalculator.h @@ -528,12 +528,12 @@ inline TensorShape compute_batch_to_space_shape(const ITensorInfo *input, const 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); + const int idx_batch = get_data_layout_dimension_index(data_layout, DataLayoutDimension::BATCHES); TensorShape output_shape{ input->tensor_shape() }; 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)); + output_shape.set(idx_batch, input->tensor_shape()[idx_batch] / (block_x * block_y)); return output_shape; } @@ -566,9 +566,15 @@ inline TensorShape compute_split_shape(const ITensorInfo *input, unsigned int ax inline TensorShape compute_space_to_batch_shape(const ITensorInfo *input, const int block_x, const int block_y, const Size2D &padding_left, const Size2D &padding_right) { TensorShape output_shape{ input->tensor_shape() }; - output_shape.set(0, input->tensor_shape()[0] * block_x + padding_left.x() + padding_right.x()); - output_shape.set(1, input->tensor_shape()[1] * block_y + padding_left.y() + padding_right.y()); - output_shape.set(3, input->tensor_shape()[3] / (block_x * block_y)); + + 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_batch = get_data_layout_dimension_index(data_layout, DataLayoutDimension::BATCHES); + + output_shape.set(idx_width, input->tensor_shape()[idx_width] * block_x + padding_left.x() + padding_right.x()); + output_shape.set(idx_height, input->tensor_shape()[idx_height] * block_y + padding_left.y() + padding_right.y()); + output_shape.set(idx_batch, input->tensor_shape()[idx_batch] / (block_x * block_y)); return output_shape; } |