From 7da29b6b12ff319ed2b6e2c46588dfa1991556fb Mon Sep 17 00:00:00 2001 From: Alex Gilday Date: Fri, 23 Mar 2018 14:16:00 +0000 Subject: COMPMID-1017: Implement dilated convolution in NEON, OpenCL, and GC Change-Id: If4626ec9e215e14dffe22e80812da5bac84a52e2 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/125734 Reviewed-by: Anthony Barbier Tested-by: Jenkins --- tests/validation/reference/ConvolutionLayer.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'tests/validation/reference/ConvolutionLayer.cpp') diff --git a/tests/validation/reference/ConvolutionLayer.cpp b/tests/validation/reference/ConvolutionLayer.cpp index f3db274935..617e85c8c2 100644 --- a/tests/validation/reference/ConvolutionLayer.cpp +++ b/tests/validation/reference/ConvolutionLayer.cpp @@ -46,7 +46,8 @@ namespace } // namespace template -SimpleTensor convolution_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &output_shape, const PadStrideInfo &info) +SimpleTensor convolution_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &output_shape, const PadStrideInfo &info, + const Size2D &dilation) { // Create reference SimpleTensor dst{ output_shape, src.data_type(), 1, src.fixed_point_position(), src.quantization_info() }; @@ -66,10 +67,10 @@ SimpleTensor convolution_layer(const SimpleTensor &src, const SimpleTensor const int stride_xi = info.stride().first; const int stride_yi = info.stride().second; - auto output_wh = scaled_dimensions(width_in, height_in, width_weights, height_weights, info); + auto output_wh = scaled_dimensions(width_in, height_in, width_weights, height_weights, info, dilation); - const int start_xi = width_weights / 2 - pad_left; - const int start_yi = height_weights / 2 - pad_top; + const int start_xi = (dilation.x() * (width_weights - 1) + 1) / 2 - pad_left; + const int start_yi = (dilation.y() * (height_weights - 1) + 1) / 2 - pad_top; const int end_xi = output_wh.first * stride_xi; const int end_yi = output_wh.second * stride_yi; const int num_batches = src.shape().total_size() / (width_in * height_in * depth_in); @@ -96,7 +97,7 @@ SimpleTensor convolution_layer(const SimpleTensor &src, const SimpleTensor offset_in, ofm * width_weights * height_weights * depth_weights, ofm, offset_out, xi, yi, width_in, height_in, depth_in, - width_weights, height_weights); + width_weights, height_weights, dilation.x(), dilation.y()); } } } @@ -106,15 +107,15 @@ SimpleTensor convolution_layer(const SimpleTensor &src, const SimpleTensor } template SimpleTensor convolution_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &output_shape, - const PadStrideInfo &info); + const PadStrideInfo &info, const Size2D &dilation); template SimpleTensor convolution_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &output_shape, - const PadStrideInfo &info); + const PadStrideInfo &info, const Size2D &dilation); template SimpleTensor convolution_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &output_shape, - const PadStrideInfo &info); + const PadStrideInfo &info, const Size2D &dilation); template SimpleTensor convolution_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &output_shape, - const PadStrideInfo &info); + const PadStrideInfo &info, const Size2D &dilation); template SimpleTensor convolution_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &output_shape, - const PadStrideInfo &info); + const PadStrideInfo &info, const Size2D &dilation); } // namespace reference } // namespace validation } // namespace test -- cgit v1.2.1