From 4bdd177c75789451cad9ba1ecf929214ed75c009 Mon Sep 17 00:00:00 2001 From: Giorgio Arena Date: Thu, 17 Dec 2020 16:47:07 +0000 Subject: Fix fill() for FP data type in fixtures - Part 2 Resolves: COMPMID-4056 Signed-off-by: Giorgio Arena Change-Id: I6623eb9c0e66e52af4e0e9fb386031f4a09125b7 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4722 Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio Comments-Addressed: Arm Jenkins --- tests/validation/fixtures/SoftmaxLayerFixture.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'tests/validation/fixtures/SoftmaxLayerFixture.h') diff --git a/tests/validation/fixtures/SoftmaxLayerFixture.h b/tests/validation/fixtures/SoftmaxLayerFixture.h index 30356d648d..ff5003d32f 100644 --- a/tests/validation/fixtures/SoftmaxLayerFixture.h +++ b/tests/validation/fixtures/SoftmaxLayerFixture.h @@ -59,16 +59,25 @@ protected: template void fill(U &&tensor) { - if(!is_data_type_quantized(tensor.data_type())) + if(tensor.data_type() == DataType::F32) { - std::uniform_real_distribution<> distribution(-10.f, 10.f); + std::uniform_real_distribution distribution(-10.0f, 10.0f); library->fill(tensor, distribution, 0); } - else // data type is quantized_asymmetric (signed or unsigned) + else if(tensor.data_type() == DataType::F16) + { + arm_compute::utils::uniform_real_distribution_fp16 distribution{ half(-10.0f), half(10.0f) }; + library->fill(tensor, distribution, 0); + } + else if(!is_data_type_quantized(tensor.data_type())) { std::uniform_int_distribution<> distribution(0, 100); library->fill(tensor, distribution, 0); } + else + { + library->fill_tensor_uniform(tensor, 0); + } } TensorType compute_target(const TensorShape &shape, DataType data_type, -- cgit v1.2.1