From 88731f01a8c8265fc087454b1468a56ac0a1a340 Mon Sep 17 00:00:00 2001 From: Michele Di Giorgio Date: Tue, 25 Sep 2018 16:49:27 +0100 Subject: COMPMID-1592: (Nightly) Fix bus error when runnint inception v3 - CL Fix access to FP16 tensor by calling the fill method with template type "half". A static cast is needed inside fill, because STL's random distribution do not support "half" data type. Change-Id: I158a261e5dd089642a667f087ea35a2f083867fe Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/150153 Reviewed-by: Michalis Spyrou Reviewed-by: Georgios Pinitas Tested-by: bsgcomp --- utils/GraphUtils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'utils') diff --git a/utils/GraphUtils.cpp b/utils/GraphUtils.cpp index bfb8ba34c3..19fba4c0bf 100644 --- a/utils/GraphUtils.cpp +++ b/utils/GraphUtils.cpp @@ -511,7 +511,7 @@ void RandomAccessor::fill(ITensor &tensor, D &&distribution) { for(size_t offset = 0; offset < tensor.info()->total_size(); offset += tensor.info()->element_size()) { - const T value = distribution(gen); + const auto value = static_cast(distribution(gen)); *reinterpret_cast(tensor.buffer() + offset) = value; } } @@ -523,7 +523,7 @@ void RandomAccessor::fill(ITensor &tensor, D &&distribution) execute_window_loop(window, [&](const Coordinates & id) { - const T value = distribution(gen); + const auto value = static_cast(distribution(gen)); *reinterpret_cast(tensor.ptr_to_element(id)) = value; }); } @@ -584,7 +584,7 @@ bool RandomAccessor::access_tensor(ITensor &tensor) case DataType::F16: { std::uniform_real_distribution distribution_f16(_lower.get(), _upper.get()); - fill(tensor, distribution_f16); + fill(tensor, distribution_f16); break; } case DataType::F32: -- cgit v1.2.1