diff options
author | Giorgio Arena <giorgio.arena@arm.com> | 2018-04-26 11:33:05 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:53:09 +0000 |
commit | c42f28d45e9b990276d54880d2cee9c9ee675a41 (patch) | |
tree | 5b407f4cc8abb67ca3c9f95c1f59e3f79859495a /arm_compute/core | |
parent | 376c85f3d826526b8b197c55e22c10765a97631e (diff) | |
download | ComputeLibrary-c42f28d45e9b990276d54880d2cee9c9ee675a41.tar.gz |
COMPMID-1048 Add NHWC data format support to Winograd input transform 4x4_3x3
https://confluence.arm.com/display/MLENG/Winograd+Input+Transform%3A+NCHW+vs+NHWC+on+OpenCL
Change-Id: Iac35a54389266701b7d8f5434a7a37df85b7b187
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/133315
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Tested-by: Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core')
-rw-r--r-- | arm_compute/core/CL/kernels/CLWinogradInputTransformKernel.h | 2 | ||||
-rw-r--r-- | arm_compute/core/utils/misc/ShapeCalculator.h | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/arm_compute/core/CL/kernels/CLWinogradInputTransformKernel.h b/arm_compute/core/CL/kernels/CLWinogradInputTransformKernel.h index b92ff2f60c..58e8291161 100644 --- a/arm_compute/core/CL/kernels/CLWinogradInputTransformKernel.h +++ b/arm_compute/core/CL/kernels/CLWinogradInputTransformKernel.h @@ -49,6 +49,7 @@ public: * @note Winograd input transform supports the following configurations: * F(output tile, kernel size):F(2x2, 3x3), F(4x4, 3x3), F(4x4, 5x5) * Strides: only unit strides + * Data Layout: NCHW for all configurations, NHWC for F(4x4, 3x3) * * @param[in] input The input tensor to transform. Data types supported: F32 * @param[in] output The output tensor. The shape for this tensor can be calculated using the utility function @p compute_winograd_input_transform_shape. Data types supported: Same as @p input @@ -60,6 +61,7 @@ public: * @note Winograd input transform supports the following configurations: * F(output tile, kernel size):F(2x2, 3x3), F(4x4, 3x3), F(4x4, 5x5) * Strides: only unit strides + * Data Layout: NCHW for all configurations, NHWC for F(4x4, 3x3) * * @param[in] input The input tensor to transform. Data types supported: F32 * @param[in] output The output tensor. The shape for this tensor can be calculated using the utility function @p compute_winograd_input_transform_shape. Data types supported: Same as @p input diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h index 9666702749..f64cf9d6ae 100644 --- a/arm_compute/core/utils/misc/ShapeCalculator.h +++ b/arm_compute/core/utils/misc/ShapeCalculator.h @@ -250,11 +250,15 @@ inline TensorShape compute_winograd_input_transform_shape(const ITensorInfo &inp const Size2D output_tile_size = winograd_info.output_tile_size; const Size2D input_tile_size = Size2D(output_tile_size.width + kernel_size.width - 1, output_tile_size.height + kernel_size.height - 1); + const size_t idx_w = get_data_layout_dimension_index(input.data_layout(), DataLayoutDimension::WIDTH); + const size_t idx_h = get_data_layout_dimension_index(input.data_layout(), DataLayoutDimension::HEIGHT); + const size_t idx_c = get_data_layout_dimension_index(input.data_layout(), DataLayoutDimension::CHANNEL); + // Compute height - const unsigned int num_tiles_x = std::ceil((input.tensor_shape().x() - (kernel_size.width - 1) + conv_info.pad_left() + conv_info.pad_right()) / static_cast<float>(output_tile_size.width)); - const unsigned int num_tiles_y = std::ceil((input.tensor_shape().y() - (kernel_size.height - 1) + conv_info.pad_top() + conv_info.pad_bottom()) / static_cast<float>(output_tile_size.height)); + const unsigned int num_tiles_x = std::ceil((input.tensor_shape()[idx_w] - (kernel_size.width - 1) + conv_info.pad_left() + conv_info.pad_right()) / static_cast<float>(output_tile_size.width)); + const unsigned int num_tiles_y = std::ceil((input.tensor_shape()[idx_h] - (kernel_size.height - 1) + conv_info.pad_top() + conv_info.pad_bottom()) / static_cast<float>(output_tile_size.height)); - const unsigned int width = input.tensor_shape()[get_data_layout_dimension_index(input.data_layout(), DataLayoutDimension::CHANNEL)]; + const unsigned int width = input.tensor_shape()[idx_c]; const unsigned int height = num_tiles_x * num_tiles_y; const unsigned int depth = input_tile_size.area(); |