diff options
author | Gian Marco Iodice <gianmarco.iodice@arm.com> | 2018-08-21 17:53:38 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:54:54 +0000 |
commit | 477531c258801caf3cce44eb3e43df611b42fc6d (patch) | |
tree | 824294059aa01b658e80c760a5fb0773341add4f /arm_compute/core/utils/misc/ShapeCalculator.h | |
parent | 4854fc3d9cac1de37e4670bc4272f44b43be8fa3 (diff) | |
download | ComputeLibrary-477531c258801caf3cce44eb3e43df611b42fc6d.tar.gz |
COMPMID-1527 - Implementing ReorgLayer on OpenCL
Also extended tests on NEON
Change-Id: Icb0eced534e904ef807972dd3a31988f501bb02e
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/147095
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Tested-by: Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core/utils/misc/ShapeCalculator.h')
-rw-r--r-- | arm_compute/core/utils/misc/ShapeCalculator.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h index d2af844b2a..d72547ed07 100644 --- a/arm_compute/core/utils/misc/ShapeCalculator.h +++ b/arm_compute/core/utils/misc/ShapeCalculator.h @@ -61,17 +61,19 @@ inline TensorShape compute_permutation_output_shape(const ITensorInfo &input, co inline TensorShape compute_reorg_output_shape(const ITensorInfo &input, int32_t stride) { - ARM_COMPUTE_ERROR_ON(stride <= 0); + const size_t idx_width = get_data_layout_dimension_index(input.data_layout(), DataLayoutDimension::WIDTH); + const size_t idx_height = get_data_layout_dimension_index(input.data_layout(), DataLayoutDimension::HEIGHT); + const size_t idx_channel = get_data_layout_dimension_index(input.data_layout(), DataLayoutDimension::CHANNEL); - const DataLayout data_layout = input.data_layout(); - const unsigned int width_idx = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH); - const unsigned int height_idx = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT); - const unsigned int channel_idx = get_data_layout_dimension_index(data_layout, DataLayoutDimension::CHANNEL); + ARM_COMPUTE_ERROR_ON(stride <= 0); + ARM_COMPUTE_ERROR_ON_MSG((input.tensor_shape()[idx_width] % stride != 0), "The width of the input tensor must be a multiple of stride"); + ARM_COMPUTE_ERROR_ON_MSG((input.tensor_shape()[idx_height] % stride != 0), "The height of the input tensor must be a multiple of stride"); TensorShape output_shape{ input.tensor_shape() }; - output_shape.set(width_idx, input.tensor_shape()[width_idx] / stride); - output_shape.set(height_idx, input.tensor_shape()[height_idx] / stride); - output_shape.set(channel_idx, input.tensor_shape()[channel_idx] * stride * stride); + + output_shape.set(idx_width, output_shape[idx_width] / stride); + output_shape.set(idx_height, output_shape[idx_height] / stride); + output_shape.set(idx_channel, output_shape[idx_channel] * stride * stride); return output_shape; } |