From 4708e02500735dcc25d5877fb74df70e49f3523e Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Fri, 8 Dec 2017 13:35:16 +0000 Subject: 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 Reviewed-by: Anthony Barbier --- .../CL/kernels/CLDirectConvolutionLayerKernel.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'src/core/CL/kernels/CLDirectConvolutionLayerKernel.cpp') 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 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 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)); -- cgit v1.2.1