diff options
author | Michele Di Giorgio <michele.digiorgio@arm.com> | 2018-09-25 16:49:27 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:55:00 +0000 |
commit | 88731f01a8c8265fc087454b1468a56ac0a1a340 (patch) | |
tree | 0c4521d97cfadd14516608f2677cd951266fd26e | |
parent | 4e1c3f336133319cfe45b037befdb252ffd9b744 (diff) | |
download | ComputeLibrary-88731f01a8c8265fc087454b1468a56ac0a1a340.tar.gz |
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 <michalis.spyrou@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Tested-by: bsgcomp <bsgcomp@arm.com>
-rw-r--r-- | utils/GraphUtils.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
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<T>(distribution(gen)); *reinterpret_cast<T *>(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<T>(distribution(gen)); *reinterpret_cast<T *>(tensor.ptr_to_element(id)) = value; }); } @@ -584,7 +584,7 @@ bool RandomAccessor::access_tensor(ITensor &tensor) case DataType::F16: { std::uniform_real_distribution<float> distribution_f16(_lower.get<float>(), _upper.get<float>()); - fill<float>(tensor, distribution_f16); + fill<half>(tensor, distribution_f16); break; } case DataType::F32: |