diff options
author | Michele Di Giorgio <michele.digiorgio@arm.com> | 2018-07-06 18:06:58 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:54:54 +0000 |
commit | 9fef38ac706aac6ff194fb76e92dcc774e12e115 (patch) | |
tree | 1621077931d2db239c93575db6991ad61ac3a1c8 /tests/validation/reference | |
parent | 72ccc440b5312160ede96f9c27c747965a5b08bf (diff) | |
download | ComputeLibrary-9fef38ac706aac6ff194fb76e92dcc774e12e115.tar.gz |
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 <michalis.spyrou@arm.com>
Tested-by: Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation/reference')
-rw-r--r-- | tests/validation/reference/ConvolutionLayer.cpp | 2 | ||||
-rw-r--r-- | tests/validation/reference/DeconvolutionLayer.cpp | 17 | ||||
-rw-r--r-- | tests/validation/reference/DeconvolutionLayer.h | 6 |
3 files changed, 16 insertions, 9 deletions
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<uint8_t> convolution_layer(const SimpleTensor<uint8_t> &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 <typename T> -SimpleTensor<T> deconvolution_layer(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const SimpleTensor<T> &bias, const TensorShape &output_shape, +template <typename T, typename TB> +SimpleTensor<T> deconvolution_layer(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const SimpleTensor<TB> &bias, const TensorShape &output_shape, const PadStrideInfo &info, const std::pair<unsigned int, unsigned int> &a) { // Create reference @@ -45,7 +45,7 @@ SimpleTensor<T> deconvolution_layer(const SimpleTensor<T> &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<T> scaled{ scaled_shape, src.data_type(), 1 }; + SimpleTensor<T> 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<T> deconvolution_layer(const SimpleTensor<T> &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<T> deconvolution_layer(const SimpleTensor<T> &src, const SimpleTens return convolution_layer(scaled, weights, bias, output_shape, conv_info); } +template SimpleTensor<uint8_t> deconvolution_layer(const SimpleTensor<uint8_t> &src, const SimpleTensor<uint8_t> &weights, const SimpleTensor<int32_t> &bias, const TensorShape &output_shape, + const PadStrideInfo &info, const std::pair<unsigned int, unsigned int> &a); template SimpleTensor<float> deconvolution_layer(const SimpleTensor<float> &src, const SimpleTensor<float> &weights, const SimpleTensor<float> &bias, const TensorShape &output_shape, const PadStrideInfo &info, const std::pair<unsigned int, unsigned int> &a); template SimpleTensor<half> deconvolution_layer(const SimpleTensor<half> &src, const SimpleTensor<half> &weights, const SimpleTensor<half> &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 <typename T> -SimpleTensor<T> deconvolution_layer(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const SimpleTensor<T> &bias, const TensorShape &output_shape, const PadStrideInfo &info, +template <typename T, typename TB> +SimpleTensor<T> deconvolution_layer(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const SimpleTensor<TB> &bias, const TensorShape &output_shape, const PadStrideInfo &info, const std::pair<unsigned int, unsigned int> &a); } // namespace reference } // namespace validation |