aboutsummaryrefslogtreecommitdiff
path: root/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp
diff options
context:
space:
mode:
authorMichalis Spyrou <michalis.spyrou@arm.com>2017-12-08 13:35:16 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:42:20 +0000
commit4708e02500735dcc25d5877fb74df70e49f3523e (patch)
tree52594e2d3e9f5b9fc0b51ca538fb56cabeb1505a /src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp
parent5dfeae62f89eefdc241887c3e67cd1c04ec0b6a7 (diff)
downloadComputeLibrary-4708e02500735dcc25d5877fb74df70e49f3523e.tar.gz
COMPMID-556 - Fixed CLDirectConvolutionLayer mismatches
Change-Id: I419ad1989b5447c7e586f62b39f4a6539a4e0462 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/112502 Tested-by: BSG Visual Compute Jenkins server to access repositories on http://mpd-gerrit.cambridge.arm.com <bsgcomp@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp')
-rw-r--r--src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp b/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp
index 9c15243a64..b38d9fbb87 100644
--- a/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp
+++ b/src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp
@@ -126,10 +126,10 @@ std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITen
unsigned int conv_stride_x = std::get<0>(conv_info.stride());
unsigned int conv_stride_y = std::get<1>(conv_info.stride());
- unsigned int conv_pad_left = std::min(conv_info.pad_left(), kernel_size / 2);
- unsigned int conv_pad_top = std::min(conv_info.pad_top(), kernel_size / 2);
- unsigned int conv_pad_right = std::min(conv_info.pad_right(), kernel_size / 2);
- unsigned int conv_pad_bottom = std::min(conv_info.pad_bottom(), kernel_size / 2);
+ unsigned int conv_pad_left = std::max(conv_info.pad_left(), kernel_size / 2);
+ unsigned int conv_pad_top = std::max(conv_info.pad_top(), kernel_size / 2);
+ unsigned int conv_pad_right = std::max(conv_info.pad_right(), kernel_size / 2);
+ unsigned int conv_pad_bottom = std::max(conv_info.pad_bottom(), kernel_size / 2);
unsigned int num_elems_read_per_iteration_x = 0;
unsigned int num_elems_read_per_iteration_y = 0;
@@ -187,18 +187,12 @@ std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITen
}
// Calculate right and bottom border
- int input_width = input->dimension(0) - kernel_size / 2 + conv_pad_right;
- int input_height = input->dimension(1) - kernel_size / 2 + conv_pad_bottom;
+ int input_width = input->dimension(0) + conv_pad_left + conv_pad_right;
+ int input_height = input->dimension(1) + conv_pad_top + conv_pad_bottom;
// Add padding only if necessary or it would always result in a window_changed
- if(input_width % num_elems_read_per_iteration_x > 0)
- {
- input_width += num_elems_read_per_iteration_x;
- }
- if(input_height % num_elems_read_per_iteration_y > 0)
- {
- input_height += num_elems_read_per_iteration_y;
- }
+ input_width += input_width % num_elems_read_per_iteration_x;
+ input_height += ((input_height / conv_stride_y) * conv_stride_y) % num_elems_read_per_iteration_y;
// Create window and update padding
win = calculate_max_window(*output, Steps(num_elems_written_per_iteration_x, num_elems_written_per_iteration_y));