aboutsummaryrefslogtreecommitdiff
path: root/src/core/CL/kernels/CLIm2ColKernel.cpp
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2018-06-21 13:07:35 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:53:10 +0000
commit09b19129b65c5b8d1ca1c3851bab919bb9b7e1a1 (patch)
tree490bc094e16785b1b7e7771f1c8d529111f1b892 /src/core/CL/kernels/CLIm2ColKernel.cpp
parentcfac9a18e477dcdf7a0c5d961edf6065131870df (diff)
downloadComputeLibrary-09b19129b65c5b8d1ca1c3851bab919bb9b7e1a1.tar.gz
COMPMID-1294: (Nightly) Fix Im2Col mismatches
Changes input_access to StaticWindow to manually add the bottom padding that is not taken into account through RectangleAccess. Change-Id: Id39223eaff08688c9ade37973023959faa6b42a6 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/136566 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Diffstat (limited to 'src/core/CL/kernels/CLIm2ColKernel.cpp')
-rw-r--r--src/core/CL/kernels/CLIm2ColKernel.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/core/CL/kernels/CLIm2ColKernel.cpp b/src/core/CL/kernels/CLIm2ColKernel.cpp
index 00d9fcb0e0..328b39681b 100644
--- a/src/core/CL/kernels/CLIm2ColKernel.cpp
+++ b/src/core/CL/kernels/CLIm2ColKernel.cpp
@@ -23,6 +23,7 @@
*/
#include "arm_compute/core/CL/kernels/CLIm2ColKernel.h"
+#include "arm_compute/core/AccessWindowStatic.h"
#include "arm_compute/core/CL/CLHelpers.h"
#include "arm_compute/core/CL/CLKernelLibrary.h"
#include "arm_compute/core/CL/CLValidate.h"
@@ -95,6 +96,13 @@ CLIm2ColKernel::configure_window(const ICLTensor *input, ICLTensor *output, cons
const bool squared_im2col = kernel_dims.width == kernel_dims.height;
const DataLayout data_layout = input->info()->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);
+ const unsigned int input_width = input->info()->dimension(width_idx);
+ const unsigned int input_height = input->info()->dimension(height_idx);
+ const unsigned int input_channel = input->info()->dimension(channel_idx);
+
if(!reduced)
{
// Default kernel name
@@ -107,13 +115,6 @@ CLIm2ColKernel::configure_window(const ICLTensor *input, ICLTensor *output, cons
kernel_name = "im2col_generic_nhwc";
}
- 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);
- const unsigned int input_width = input->info()->dimension(width_idx);
- const unsigned int input_height = input->info()->dimension(height_idx);
- const unsigned int input_channel = input->info()->dimension(channel_idx);
-
_convolved_dims = scaled_dimensions(input_width, input_height, kernel_dims.width, kernel_dims.height, conv_info, dilation);
build_opts.add_option("-DKERNEL_WIDTH=" + support::cpp11::to_string(kernel_dims.width));
@@ -255,16 +256,14 @@ CLIm2ColKernel::configure_window(const ICLTensor *input, ICLTensor *output, cons
}
else
{
+ const BorderSize border(conv_info.pad_top(), conv_info.pad_right(), conv_info.pad_bottom(), conv_info.pad_left());
win = calculate_max_window(*input->info(),
- Steps(_num_elems_processed_per_iteration),
- false,
- BorderSize(conv_info.pad_top(), conv_info.pad_right(), conv_info.pad_bottom(), conv_info.pad_left()));
-
- const int x = -conv_info.pad_left();
- const int y = -conv_info.pad_top();
- const int w = kernel_dims.width * _num_elems_processed_per_iteration;
- const int h = kernel_dims.height;
- AccessWindowRectangle input_access(input->info(), x, y, w, h);
+ Steps(_num_elems_processed_per_iteration * conv_info.stride().first, conv_info.stride().second));
+ AccessWindowStatic input_access(input->info(),
+ -border.left,
+ -border.top,
+ ceil_to_multiple(input_width + border.right, kernel_dims.width),
+ input_height + border.bottom);
update_window_and_padding(win, input_access);
}
}