From 9fef38ac706aac6ff194fb76e92dcc774e12e115 Mon Sep 17 00:00:00 2001 From: Michele Di Giorgio Date: Fri, 6 Jul 2018 18:06:58 +0100 Subject: COMPMID-1376: Add support for QASYMM8 in CLDeconvolutionLayer Change-Id: I13ec79b6668e2b9559d3fa789ae0b51ab6975289 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/139126 Reviewed-by: Michalis Spyrou Tested-by: Jenkins --- tests/validation/reference/ConvolutionLayer.cpp | 2 +- tests/validation/reference/DeconvolutionLayer.cpp | 17 ++++++++++++----- tests/validation/reference/DeconvolutionLayer.h | 6 +++--- 3 files changed, 16 insertions(+), 9 deletions(-) (limited to 'tests/validation/reference') diff --git a/tests/validation/reference/ConvolutionLayer.cpp b/tests/validation/reference/ConvolutionLayer.cpp index e212e2742f..2d314059dd 100644 --- a/tests/validation/reference/ConvolutionLayer.cpp +++ b/tests/validation/reference/ConvolutionLayer.cpp @@ -132,4 +132,4 @@ template SimpleTensor convolution_layer(const SimpleTensor &sr } // namespace reference } // namespace validation } // namespace test -} // namespace arm_compute \ No newline at end of file +} // namespace arm_compute diff --git a/tests/validation/reference/DeconvolutionLayer.cpp b/tests/validation/reference/DeconvolutionLayer.cpp index e73023e419..ba28b46d3a 100644 --- a/tests/validation/reference/DeconvolutionLayer.cpp +++ b/tests/validation/reference/DeconvolutionLayer.cpp @@ -33,8 +33,8 @@ namespace validation { namespace reference { -template -SimpleTensor deconvolution_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &output_shape, +template +SimpleTensor deconvolution_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &output_shape, const PadStrideInfo &info, const std::pair &a) { // Create reference @@ -45,7 +45,7 @@ SimpleTensor deconvolution_layer(const SimpleTensor &src, const SimpleTens int out_y = src.shape().y() + (src.shape().y() - 1) * (stride_y - 1) + a.second + 2 * info.pad().second; scaled_shape.set(0, out_x); scaled_shape.set(1, out_y); - SimpleTensor scaled{ scaled_shape, src.data_type(), 1 }; + SimpleTensor scaled{ scaled_shape, src.data_type(), 1, src.quantization_info() }; const int width_in = src.shape().x(); const int height_in = src.shape().y(); @@ -59,9 +59,14 @@ SimpleTensor deconvolution_layer(const SimpleTensor &src, const SimpleTens 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"); - for(int j = 0; j < scaled.num_elements(); ++j) + if(src.data_type() == DataType::QASYMM8) { - scaled[j] = T(0); + const uint8_t quantized_zero = src.quantization_info().offset; + std::fill_n(scaled.data(), scaled.num_elements(), quantized_zero); + } + else + { + std::fill_n(scaled.data(), scaled.num_elements(), T(0)); } for(int slice = 0; slice < num_2d_slices; ++slice) @@ -88,6 +93,8 @@ SimpleTensor deconvolution_layer(const SimpleTensor &src, const SimpleTens return convolution_layer(scaled, weights, bias, output_shape, conv_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); template SimpleTensor deconvolution_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &output_shape, const PadStrideInfo &info, const std::pair &a); template SimpleTensor deconvolution_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &output_shape, diff --git a/tests/validation/reference/DeconvolutionLayer.h b/tests/validation/reference/DeconvolutionLayer.h index c0bc1fa928..95fb416b30 100644 --- a/tests/validation/reference/DeconvolutionLayer.h +++ b/tests/validation/reference/DeconvolutionLayer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -45,8 +45,8 @@ namespace reference * a The number of zeros added to right and top edges of the input. * */ -template -SimpleTensor deconvolution_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &output_shape, 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); } // namespace reference } // namespace validation -- cgit v1.2.1