From a69a88b0b69c4c4018562afcfd560ae94412ec99 Mon Sep 17 00:00:00 2001 From: giuros01 Date: Thu, 31 Jan 2019 16:29:19 +0000 Subject: COMPMID-1915: Deconvolution doesn't work when inner_dimension_top != 0 or inner_dimension_right != 0 Change-Id: Ia0533cfb34878fc81e929eb405c49e46609d26b8 Signed-off-by: giuros01 Reviewed-on: https://review.mlplatform.org/616 Reviewed-by: Georgios Pinitas Tested-by: Arm Jenkins --- tests/validation/reference/DeconvolutionLayer.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'tests/validation/reference/DeconvolutionLayer.cpp') diff --git a/tests/validation/reference/DeconvolutionLayer.cpp b/tests/validation/reference/DeconvolutionLayer.cpp index 5ca3b44baa..916792479f 100644 --- a/tests/validation/reference/DeconvolutionLayer.cpp +++ b/tests/validation/reference/DeconvolutionLayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -35,7 +35,7 @@ namespace reference { template SimpleTensor deconvolution_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &output_shape, - const PadStrideInfo &info, const std::pair &a) + const PadStrideInfo &info) { // Create reference const int stride_x = info.stride().first; @@ -45,8 +45,8 @@ SimpleTensor deconvolution_layer(const SimpleTensor &src, const SimpleTens const int weights_upper_dims = weights.shape().total_size() / (weights_width * weights_height); // Find the upsampled dimensions - unsigned int out_x = (src.shape().x() - 1) * stride_x + a.first + 1; - unsigned int out_y = (src.shape().y() - 1) * stride_y + a.second + 1; + unsigned int out_x = (src.shape().x() - 1) * stride_x + 1; + unsigned int out_y = (src.shape().y() - 1) * stride_y + 1; // Find the padding needed for the convolution with stride 1 in order to match output shape unsigned int padx = output_shape.x() - (out_x - weights_width + 1); @@ -64,13 +64,8 @@ SimpleTensor deconvolution_layer(const SimpleTensor &src, const SimpleTens const int width_scaled = scaled.shape().x(); const int height_scaled = scaled.shape().y(); const int num_2d_slices = src.shape().total_size() / (width_in * height_in); - const int ax = a.first; // The number of zeros added to right edge of the input. - const int ay = a.second; // The number of zeros added to top edge of the input. ARM_COMPUTE_ERROR_ON(info.pad().first > (weights.shape().x() - 1)); - ARM_COMPUTE_ERROR_ON_MSG(ax > stride_x - 1, "ax must be smaller than stride_x"); - ARM_COMPUTE_ERROR_ON_MSG(ay > stride_y - 1, "ay must be smaller than stride_y"); - if(src.data_type() == DataType::QASYMM8) { const uint8_t quantized_zero = src.quantization_info().offset; @@ -100,9 +95,9 @@ SimpleTensor deconvolution_layer(const SimpleTensor &src, const SimpleTens const int offset_slice_in = slice * width_in * height_in; const int offset_slice_out = slice * width_scaled * height_scaled; const int start_x = padx / 2; - const int start_y = ay + pady / 2; + const int start_y = pady / 2; const int end_y = height_scaled - pady / 2; - const int end_x = width_scaled - ax - padx / 2; + const int end_x = width_scaled - padx / 2; for(int yi = start_y, in_y = 0; yi < end_y; yi += stride_y, in_y++) { @@ -120,11 +115,11 @@ SimpleTensor deconvolution_layer(const SimpleTensor &src, const SimpleTens } template SimpleTensor deconvolution_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &output_shape, - const PadStrideInfo &info, const std::pair &a); + const PadStrideInfo &info); template SimpleTensor deconvolution_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &output_shape, - const PadStrideInfo &info, const std::pair &a); + const PadStrideInfo &info); template SimpleTensor deconvolution_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &output_shape, - const PadStrideInfo &info, const std::pair &a); + const PadStrideInfo &info); } // namespace reference } // namespace validation } // namespace test -- cgit v1.2.1