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/AssetsLibrary.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/AssetsLibrary.h') diff --git a/tests/AssetsLibrary.h b/tests/AssetsLibrary.h index 8230a93fbd..5e34365692 100644 --- a/tests/AssetsLibrary.h +++ b/tests/AssetsLibrary.h @@ -534,12 +534,14 @@ void AssetsLibrary::fill_borders_with_garbage(T &&tensor, D &&distribution, std: template void AssetsLibrary::fill_boxes(T &&tensor, D &&distribution, std::random_device::result_type seed_offset) const { - using ResultType = typename std::remove_reference::type::result_type; + using DistributionType = typename std::remove_reference::type; + using ResultType = typename DistributionType::result_type; + std::mt19937 gen(_seed + seed_offset); TensorShape shape(tensor.shape()); const uint32_t num_boxes = tensor.num_elements() / 4; // Iterate over all elements - std::uniform_real_distribution<> size_dist(0.f, 1.f); + DistributionType size_dist{ ResultType(0.f), ResultType(1.f) }; for(uint32_t element_idx = 0; element_idx < num_boxes * 4; element_idx += 4) { const ResultType delta = size_dist(gen); -- cgit v1.2.1