Narumol Prangnawarat | 7ddbbae | 2020-03-13 10:26:05 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2020 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "RefConvertBf16ToFp32Workload.hpp" |
| 7 | #include "RefWorkloadUtils.hpp" |
| 8 | |
| 9 | #include <armnnUtils/FloatingPointConverter.hpp> |
| 10 | |
| 11 | #include <BFloat16.hpp> |
| 12 | |
| 13 | namespace armnn |
| 14 | { |
| 15 | |
| 16 | void RefConvertBf16ToFp32Workload::Execute() const |
| 17 | { |
| 18 | ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefConvertBf16ToFp32Workload_Execute"); |
| 19 | |
| 20 | const BFloat16* const input = GetInputTensorDataBFloat16(0, m_Data); |
| 21 | float* const output = GetOutputTensorDataFloat(0, m_Data); |
| 22 | |
| 23 | unsigned int numElements = GetTensorInfo(m_Data.m_Inputs[0]).GetNumElements(); |
| 24 | armnnUtils::FloatingPointConverter::ConvertBFloat16ToFloat32(input, numElements, output); |
| 25 | } |
| 26 | |
| 27 | } //namespace armnn |