diff options
author | Giorgio Arena <giorgio.arena@arm.com> | 2021-02-17 16:04:05 +0000 |
---|---|---|
committer | Giorgio Arena <giorgio.arena@arm.com> | 2021-02-18 14:01:18 +0000 |
commit | 95235f49c2389a8013c4ca68affe29745b257011 (patch) | |
tree | 347fa0e4868106cbd85447318a3c61326fd10ec2 | |
parent | 7b32098ff6933f0421fab659c25620d47c33fc8a (diff) | |
download | armcl-95235f49c2389a8013c4ca68affe29745b257011.tar.gz armcl-95235f49c2389a8013c4ca68affe29745b257011.tar.bz2 armcl-95235f49c2389a8013c4ca68affe29745b257011.zip |
Set CLDirectConvolutionLayerKernel NCHW _border_size to input padding
Change-Id: I5802c470683647b7426b3b6e7d17280cabc32163
Signed-off-by: Giorgio Arena <giorgio.arena@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5100
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r-- | src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp | 11 | ||||
-rw-r--r-- | src/core/CL/kernels/CLDirectConvolutionLayerKernel.h | 3 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp b/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp index 3948261bc..2fc3c60f6 100644 --- a/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp +++ b/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp @@ -317,7 +317,7 @@ std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITen } // namespace CLDirectConvolutionLayerKernel::CLDirectConvolutionLayerKernel() - : _input(nullptr), _biases(nullptr), _weights(nullptr), _output(nullptr), _data_layout(DataLayout::UNKNOWN), _border_size(0), _conv_stride_x(0), _conv_stride_y(0) + : _input(nullptr), _biases(nullptr), _weights(nullptr), _output(nullptr), _data_layout(DataLayout::UNKNOWN), _border_size(0), _conv_stride_x(0), _conv_stride_y(0), _conv_info() { } @@ -350,6 +350,7 @@ void CLDirectConvolutionLayerKernel::configure(const CLCompileContext &compile_c _weights = weights; _output = output; _biases = biases; + _conv_info = conv_info; 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); @@ -381,7 +382,7 @@ void CLDirectConvolutionLayerKernel::configure(const CLCompileContext &compile_c const unsigned int pad_left = conv_info.pad_left(); const unsigned int pad_top = conv_info.pad_top(); - if (_biases != nullptr) + if(_biases != nullptr) { build_options.add_option(std::string("-DHAS_BIAS")); build_options.add_option(std::string("-DBIA_DATA_TYPE=" + get_cl_type_from_data_type(_biases->info()->data_type()))); @@ -440,7 +441,7 @@ void CLDirectConvolutionLayerKernel::configure(const CLCompileContext &compile_c } else { - _border_size = BorderSize(conv_info.pad_top(), conv_info.pad_right(), conv_info.pad_bottom(), conv_info.pad_left()); + _border_size = BorderSize(_input->info()->padding()); kernel_name << "direct_convolution" << kernel_size << "x" << kernel_size; @@ -549,8 +550,8 @@ void CLDirectConvolutionLayerKernel::run(const Window &window, cl::CommandQueue { Window win_in = window; - win_in.adjust(Window::DimX, -_border_size.left, true); - win_in.adjust(Window::DimY, -_border_size.top, true); + win_in.adjust(Window::DimX, -_conv_info.pad_left(), true); + win_in.adjust(Window::DimY, -_conv_info.pad_top(), true); const int width_idx = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::WIDTH); const int height_idx = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::HEIGHT); diff --git a/src/core/CL/kernels/CLDirectConvolutionLayerKernel.h b/src/core/CL/kernels/CLDirectConvolutionLayerKernel.h index 5cd674f63..0257d0c2d 100644 --- a/src/core/CL/kernels/CLDirectConvolutionLayerKernel.h +++ b/src/core/CL/kernels/CLDirectConvolutionLayerKernel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -120,6 +120,7 @@ public: BorderSize _border_size; int _conv_stride_x; int _conv_stride_y; + PadStrideInfo _conv_info; }; } // namespace arm_compute #endif /*ARM_COMPUTE_CLDIRECTCONVOLUTIONLAYERKERNEL_H */ |