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