blob: 33270ad10fcd3b507d8b2273c9c273d8633a67d0 [file] [log] [blame]
telsoa01c577f2c2018-08-31 09:22:23 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
David Beckecb56cd2018-09-05 12:52:57 +01003// SPDX-License-Identifier: MIT
telsoa01c577f2c2018-08-31 09:22:23 +01004//
5
6#include "RefConvertFp32ToFp16Workload.hpp"
7
telsoa01c577f2c2018-08-31 09:22:23 +01008#include "FloatingPointConverter.hpp"
9#include "RefWorkloadUtils.hpp"
telsoa01c577f2c2018-08-31 09:22:23 +010010#include "Profiling.hpp"
11
Aron Virginas-Tarc9cc8042018-11-01 16:15:57 +000012#include "Half.hpp"
arovir01616e7752018-10-01 17:08:59 +010013
telsoa01c577f2c2018-08-31 09:22:23 +010014namespace armnn
15{
16
17void 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