From 9e631c204444e7b095510c54819e944f9be8d342 Mon Sep 17 00:00:00 2001 From: Usama Arif Date: Tue, 14 May 2019 17:10:40 +0100 Subject: COMPMID-2252 NECast. Change-Id: I7532aea6827a325eb8457132d4787ac527e93cd4 Signed-off-by: Usama Arif Reviewed-on: https://review.mlplatform.org/c/1149 Reviewed-by: Pablo Marquez Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Georgios Pinitas --- tests/validation/fixtures/DepthConvertLayerFixture.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'tests/validation/fixtures/DepthConvertLayerFixture.h') diff --git a/tests/validation/fixtures/DepthConvertLayerFixture.h b/tests/validation/fixtures/DepthConvertLayerFixture.h index a3d379eede..3fe12709c8 100644 --- a/tests/validation/fixtures/DepthConvertLayerFixture.h +++ b/tests/validation/fixtures/DepthConvertLayerFixture.h @@ -40,6 +40,7 @@ namespace test { namespace validation { +/* This function ignores the scale and zeroPoint of quanized tensors, i.e. QASYMM8 input is treated as uint8 values.*/ template class DepthConvertLayerValidationBaseFixture : public framework::Fixture { @@ -55,7 +56,7 @@ public: protected: template - void fill(U &&tensor, int i) + void fill(U &&tensor, int i, DataType dt_in, DataType dt_out) { if(is_data_type_quantized(tensor.data_type())) { @@ -66,7 +67,16 @@ protected: } else { - library->fill_tensor_uniform(tensor, i); + // When converting S32 to F16, both reference and NEON implementations are + or - infinity outside the F16 range. + if(dt_in==DataType::S32 && dt_out==DataType::F16) + { + std::uniform_int_distribution distribution_s32(-65504, 65504); + library->fill(tensor, distribution_s32, i); + } + else + { + library->fill_tensor_uniform(tensor, i); + } } } @@ -91,7 +101,7 @@ protected: ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS); // Fill tensors - fill(AccessorType(src), 0); + fill(AccessorType(src), 0, dt_in, dt_out); // Compute function depth_convert.run(); @@ -105,7 +115,7 @@ protected: SimpleTensor src{ shape, dt_in, 1, _quantization_info }; // Fill reference - fill(src, 0); + fill(src, 0, dt_in, dt_out); return reference::depth_convert(src, dt_out, policy, shift); } -- cgit v1.2.1