diff options
author | Michele Di Giorgio <michele.digiorgio@arm.com> | 2018-09-12 10:18:54 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:54:54 +0000 |
commit | d63dfa2fc61a33b4e675ec6bc7458d8700174134 (patch) | |
tree | 2a85a8258aaa9a5762eb589f34b3f2868705dfb5 /tests/validation/fixtures | |
parent | 20c246a60869bada4051bd14eb9a3862be5330d7 (diff) | |
download | ComputeLibrary-d63dfa2fc61a33b4e675ec6bc7458d8700174134.tar.gz |
COMPMID-1568: Add support for QASYMM8 to CLNormalizePlanarYUV
Change-Id: Id7ea6e7f57179478e5ba0e9231274e98fa089590
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/148028
Tested-by: bsgcomp <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'tests/validation/fixtures')
-rw-r--r-- | tests/validation/fixtures/NormalizePlanarYUVLayerFixture.h | 54 |
1 files changed, 41 insertions, 13 deletions
diff --git a/tests/validation/fixtures/NormalizePlanarYUVLayerFixture.h b/tests/validation/fixtures/NormalizePlanarYUVLayerFixture.h index cc73e530ef..9d8c8fcbce 100644 --- a/tests/validation/fixtures/NormalizePlanarYUVLayerFixture.h +++ b/tests/validation/fixtures/NormalizePlanarYUVLayerFixture.h @@ -41,15 +41,15 @@ namespace test namespace validation { template <typename TensorType, typename AccessorType, typename FunctionType, typename T> -class NormalizePlanarYUVLayerValidationFixture : public framework::Fixture +class NormalizePlanarYUVLayerValidationGenericFixture : public framework::Fixture { public: template <typename...> - void setup(TensorShape shape0, TensorShape shape1, DataType dt, DataLayout data_layout) + void setup(TensorShape shape0, TensorShape shape1, DataType dt, DataLayout data_layout, QuantizationInfo quantization_info) { _data_type = dt; - _target = compute_target(shape0, shape1, dt, data_layout); - _reference = compute_reference(shape0, shape1, dt); + _target = compute_target(shape0, shape1, dt, data_layout, quantization_info); + _reference = compute_reference(shape0, shape1, dt, quantization_info); } protected: @@ -67,9 +67,15 @@ protected: library->fill(mean_tensor, distribution, 1); library->fill(std_tensor, distribution_std, 2); } + else if(is_data_type_quantized_asymmetric(src_tensor.data_type())) + { + library->fill_tensor_uniform(src_tensor, 0); + library->fill_tensor_uniform(mean_tensor, 1); + library->fill_tensor_uniform(std_tensor, 2); + } } - TensorType compute_target(TensorShape shape0, const TensorShape &shape1, DataType dt, DataLayout data_layout) + TensorType compute_target(TensorShape shape0, const TensorShape &shape1, DataType dt, DataLayout data_layout, QuantizationInfo quantization_info) { if(data_layout == DataLayout::NHWC) { @@ -77,10 +83,10 @@ protected: } // Create tensors - TensorType src = create_tensor<TensorType>(shape0, dt, 1, QuantizationInfo(), data_layout); - TensorType dst = create_tensor<TensorType>(shape0, dt, 1, QuantizationInfo(), data_layout); - TensorType mean = create_tensor<TensorType>(shape1, dt, 1); - TensorType std = create_tensor<TensorType>(shape1, dt, 1); + TensorType src = create_tensor<TensorType>(shape0, dt, 1, quantization_info, data_layout); + TensorType mean = create_tensor<TensorType>(shape1, dt, 1, quantization_info); + TensorType std = create_tensor<TensorType>(shape1, dt, 1, quantization_info); + TensorType dst; // Create and configure function FunctionType norm; @@ -111,12 +117,12 @@ protected: return dst; } - SimpleTensor<T> compute_reference(const TensorShape &shape0, const TensorShape &shape1, DataType dt) + SimpleTensor<T> compute_reference(const TensorShape &shape0, const TensorShape &shape1, DataType dt, QuantizationInfo quantization_info) { // Create reference - SimpleTensor<T> ref_src{ shape0, dt, 1 }; - SimpleTensor<T> ref_mean{ shape1, dt, 1 }; - SimpleTensor<T> ref_std{ shape1, dt, 1 }; + SimpleTensor<T> ref_src{ shape0, dt, 1, quantization_info }; + SimpleTensor<T> ref_mean{ shape1, dt, 1, quantization_info }; + SimpleTensor<T> ref_std{ shape1, dt, 1, quantization_info }; // Fill reference fill(ref_src, ref_mean, ref_std); @@ -128,6 +134,28 @@ protected: SimpleTensor<T> _reference{}; DataType _data_type{}; }; + +template <typename TensorType, typename AccessorType, typename FunctionType, typename T> +class NormalizePlanarYUVLayerValidationFixture : public NormalizePlanarYUVLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T> +{ +public: + template <typename...> + void setup(TensorShape shape0, TensorShape shape1, DataType dt, DataLayout data_layout) + { + NormalizePlanarYUVLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape0, shape1, dt, data_layout, QuantizationInfo()); + } +}; + +template <typename TensorType, typename AccessorType, typename FunctionType, typename T> +class NormalizePlanarYUVLayerValidationQuantizedFixture : public NormalizePlanarYUVLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T> +{ +public: + template <typename...> + void setup(TensorShape shape0, TensorShape shape1, DataType dt, DataLayout data_layout, QuantizationInfo quantization_info) + { + NormalizePlanarYUVLayerValidationGenericFixture<TensorType, AccessorType, FunctionType, T>::setup(shape0, shape1, dt, data_layout, quantization_info); + } +}; } // namespace validation } // namespace test } // namespace arm_compute |