diff options
author | Michele Di Giorgio <michele.digiorgio@arm.com> | 2019-12-20 13:26:08 +0000 |
---|---|---|
committer | Michele Di Giorgio <michele.digiorgio@arm.com> | 2020-01-14 17:21:26 +0000 |
commit | cbbed288a71f2f048123db3cf396361e5d66ce93 (patch) | |
tree | bd48122e283272adb668a42097ea69ca3f0473a6 /tests/validation/reference | |
parent | 70d33bdfd36e1b44b0573189dca67ed7c63dd59e (diff) | |
download | ComputeLibrary-cbbed288a71f2f048123db3cf396361e5d66ce93.tar.gz |
COMPMID-2991: Add support for QASYMM8_SIGNED in CL kernels/functions - part 2
Adding support for QASYMM8_SIGNED to the following CL kernels/functions:
- CLActivationLayerKernel/CLActivationLayer
- CLComparisonKernel/CLComparison
- CLConvertFullyConnectedWeightsKernel/CLConvertFullyConnectedWeights
- CLDeconvolutionLayerUpsampleKernel/CLDeconvolutionLayerUpsample
- CLDepthToSpaceLayerKernel/CLDepthToSpaceLayer
- CLDequantizationLayerKernel/CLDequantizationLayer
- CLGEMMMatrixVectorMultiplyKernel
- CLNormalizePlanarYUVLayerKernel
- CLPReluLayer
- CLPixelWiseMultiplicationKernel/CLPixelWiseMultiplication
- CLPoolingLayerKernel/CLPoolingLayer
Change-Id: I874bbb7c2b08baa9c5ff4c9e6bc8778b42a6bec5
Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Reviewed-on: https://review.mlplatform.org/c/2539
Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation/reference')
-rw-r--r-- | tests/validation/reference/NormalizePlanarYUVLayer.cpp | 13 | ||||
-rw-r--r-- | tests/validation/reference/PoolingLayer.cpp | 11 | ||||
-rw-r--r-- | tests/validation/reference/UpsampleLayer.cpp | 33 |
3 files changed, 26 insertions, 31 deletions
diff --git a/tests/validation/reference/NormalizePlanarYUVLayer.cpp b/tests/validation/reference/NormalizePlanarYUVLayer.cpp index ea0e75a3c7..d2d29cc682 100644 --- a/tests/validation/reference/NormalizePlanarYUVLayer.cpp +++ b/tests/validation/reference/NormalizePlanarYUVLayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2020 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -72,6 +72,17 @@ SimpleTensor<uint8_t> normalize_planar_yuv_layer<uint8_t>(const SimpleTensor<uin return dst; } +template <> +SimpleTensor<int8_t> normalize_planar_yuv_layer<int8_t>(const SimpleTensor<int8_t> &src, const SimpleTensor<int8_t> &mean, const SimpleTensor<int8_t> &std) +{ + SimpleTensor<float> src_tmp = convert_from_asymmetric(src); + SimpleTensor<float> mean_tmp = convert_from_asymmetric(mean); + SimpleTensor<float> std_tmp = convert_from_asymmetric(std); + SimpleTensor<float> dst_tmp = normalize_planar_yuv_layer<float>(src_tmp, mean_tmp, std_tmp); + SimpleTensor<int8_t> dst = convert_to_asymmetric<int8_t>(dst_tmp, src.quantization_info()); + return dst; +} + template SimpleTensor<half> normalize_planar_yuv_layer(const SimpleTensor<half> &src, const SimpleTensor<half> &mean, const SimpleTensor<half> &std); template SimpleTensor<float> normalize_planar_yuv_layer(const SimpleTensor<float> &src, const SimpleTensor<float> &mean, const SimpleTensor<float> &std); } // namespace reference diff --git a/tests/validation/reference/PoolingLayer.cpp b/tests/validation/reference/PoolingLayer.cpp index 010412c92b..40dd6fa505 100644 --- a/tests/validation/reference/PoolingLayer.cpp +++ b/tests/validation/reference/PoolingLayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 ARM Limited. + * Copyright (c) 2017-2020 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -172,6 +172,15 @@ SimpleTensor<uint8_t> pooling_layer<uint8_t>(const SimpleTensor<uint8_t> &src, c } template <> +SimpleTensor<int8_t> pooling_layer<int8_t>(const SimpleTensor<int8_t> &src, const PoolingLayerInfo &info, const QuantizationInfo &output_qinfo) +{ + SimpleTensor<float> src_tmp = convert_from_asymmetric(src); + SimpleTensor<float> dst_tmp = pooling_layer_internal<float>(src_tmp, info, output_qinfo); + SimpleTensor<int8_t> dst = convert_to_asymmetric<int8_t>(dst_tmp, output_qinfo); + return dst; +} + +template <> SimpleTensor<half> pooling_layer(const SimpleTensor<half> &src, const PoolingLayerInfo &info, const QuantizationInfo &output_qinfo) { if(src.data_type() == DataType::F16 && info.fp_mixed_precision()) diff --git a/tests/validation/reference/UpsampleLayer.cpp b/tests/validation/reference/UpsampleLayer.cpp index d77f9ae348..a81a601057 100644 --- a/tests/validation/reference/UpsampleLayer.cpp +++ b/tests/validation/reference/UpsampleLayer.cpp @@ -23,6 +23,7 @@ */ #include "UpsampleLayer.h" +#include "arm_compute/core/utils/misc/Requires.h" #include "tests/validation/Helpers.h" namespace arm_compute @@ -33,10 +34,8 @@ namespace validation { namespace reference { -namespace -{ template <typename T> -SimpleTensor<T> upsample_function(const SimpleTensor<T> &src, const Size2D &info, const InterpolationPolicy policy) +SimpleTensor<T> upsample_layer(const SimpleTensor<T> &src, const Size2D &info, const InterpolationPolicy policy) { ARM_COMPUTE_ERROR_ON(policy != InterpolationPolicy::NEAREST_NEIGHBOR); ARM_COMPUTE_UNUSED(policy); @@ -76,36 +75,12 @@ SimpleTensor<T> upsample_function(const SimpleTensor<T> &src, const Size2D &info return out; } -} // namespace - -template <typename T> -SimpleTensor<T> upsample_layer(const SimpleTensor<T> &src, const Size2D &info, const InterpolationPolicy policy) -{ - return upsample_function<T>(src, info, policy); -} - -template <> -SimpleTensor<uint8_t> upsample_layer(const SimpleTensor<uint8_t> &src, const Size2D &info, const InterpolationPolicy policy) -{ - SimpleTensor<uint8_t> dst(src.shape(), src.data_type(), 1, src.quantization_info()); - - if(is_data_type_quantized_asymmetric(src.data_type())) - { - SimpleTensor<float> src_tmp = convert_from_asymmetric(src); - SimpleTensor<float> dst_tmp = upsample_function<float>(src_tmp, info, policy); - dst = convert_to_asymmetric<uint8_t>(dst_tmp, src.quantization_info()); - } - else - { - dst = upsample_function<uint8_t>(src, info, policy); - } - return dst; -} - template SimpleTensor<float> upsample_layer(const SimpleTensor<float> &src, const Size2D &info, const InterpolationPolicy policy); template SimpleTensor<half> upsample_layer(const SimpleTensor<half> &src, const Size2D &info, const InterpolationPolicy policy); +template SimpleTensor<uint8_t> upsample_layer(const SimpleTensor<uint8_t> &src, + const Size2D &info, const InterpolationPolicy policy); template SimpleTensor<int8_t> upsample_layer(const SimpleTensor<int8_t> &src, const Size2D &info, const InterpolationPolicy policy); } // namespace reference |