• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "RefConvertFp32ToFp16Workload.hpp"
7 #include "RefWorkloadUtils.hpp"
8 #include "Profiling.hpp"
9 
10 #include <armnnUtils/FloatingPointConverter.hpp>
11 
12 #include <Half.hpp>
13 
14 namespace armnn
15 {
16 
Execute() const17 void RefConvertFp32ToFp16Workload::Execute() const
18 {
19     ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefConvertFp32ToFp16Workload_Execute");
20 
21     const float* const input = GetInputTensorDataFloat(0, m_Data);
22     Half*  const output = GetOutputTensorDataHalf(0, m_Data);
23 
24     // convert Fp32 input to Fp16 output
25     unsigned int numElements = GetTensorInfo(m_Data.m_Inputs[0]).GetNumElements();
26     armnnUtils::FloatingPointConverter::ConvertFloat32To16(input, numElements, output);
27 }
28 
29 } //namespace armnn
30