From d63dfa2fc61a33b4e675ec6bc7458d8700174134 Mon Sep 17 00:00:00 2001 From: Michele Di Giorgio Date: Wed, 12 Sep 2018 10:18:54 +0100 Subject: COMPMID-1568: Add support for QASYMM8 to CLNormalizePlanarYUV Change-Id: Id7ea6e7f57179478e5ba0e9231274e98fa089590 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/148028 Tested-by: bsgcomp Reviewed-by: Georgios Pinitas --- .../fixtures/NormalizePlanarYUVLayerFixture.h | 54 ++++++++++++++++------ 1 file changed, 41 insertions(+), 13 deletions(-) (limited to 'tests/validation/fixtures') 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 -class NormalizePlanarYUVLayerValidationFixture : public framework::Fixture +class NormalizePlanarYUVLayerValidationGenericFixture : public framework::Fixture { public: template - 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(shape0, dt, 1, QuantizationInfo(), data_layout); - TensorType dst = create_tensor(shape0, dt, 1, QuantizationInfo(), data_layout); - TensorType mean = create_tensor(shape1, dt, 1); - TensorType std = create_tensor(shape1, dt, 1); + TensorType src = create_tensor(shape0, dt, 1, quantization_info, data_layout); + TensorType mean = create_tensor(shape1, dt, 1, quantization_info); + TensorType std = create_tensor(shape1, dt, 1, quantization_info); + TensorType dst; // Create and configure function FunctionType norm; @@ -111,12 +117,12 @@ protected: return dst; } - SimpleTensor compute_reference(const TensorShape &shape0, const TensorShape &shape1, DataType dt) + SimpleTensor compute_reference(const TensorShape &shape0, const TensorShape &shape1, DataType dt, QuantizationInfo quantization_info) { // Create reference - SimpleTensor ref_src{ shape0, dt, 1 }; - SimpleTensor ref_mean{ shape1, dt, 1 }; - SimpleTensor ref_std{ shape1, dt, 1 }; + SimpleTensor ref_src{ shape0, dt, 1, quantization_info }; + SimpleTensor ref_mean{ shape1, dt, 1, quantization_info }; + SimpleTensor ref_std{ shape1, dt, 1, quantization_info }; // Fill reference fill(ref_src, ref_mean, ref_std); @@ -128,6 +134,28 @@ protected: SimpleTensor _reference{}; DataType _data_type{}; }; + +template +class NormalizePlanarYUVLayerValidationFixture : public NormalizePlanarYUVLayerValidationGenericFixture +{ +public: + template + void setup(TensorShape shape0, TensorShape shape1, DataType dt, DataLayout data_layout) + { + NormalizePlanarYUVLayerValidationGenericFixture::setup(shape0, shape1, dt, data_layout, QuantizationInfo()); + } +}; + +template +class NormalizePlanarYUVLayerValidationQuantizedFixture : public NormalizePlanarYUVLayerValidationGenericFixture +{ +public: + template + void setup(TensorShape shape0, TensorShape shape1, DataType dt, DataLayout data_layout, QuantizationInfo quantization_info) + { + NormalizePlanarYUVLayerValidationGenericFixture::setup(shape0, shape1, dt, data_layout, quantization_info); + } +}; } // namespace validation } // namespace test } // namespace arm_compute -- cgit v1.2.1