ArmNN
 21.02
RefConvertFp32ToFp16Workload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 #include "RefWorkloadUtils.hpp"
8 #include "Profiling.hpp"
9 
11 
12 #include <Half.hpp>
13 
14 namespace armnn
15 {
16 
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();
27 }
28 
29 } //namespace armnn
const float * GetInputTensorDataFloat(unsigned int idx, const PayloadType &data)
CPU Execution: Reference C++ kernels.
const QueueDescriptor m_Data
Definition: Workload.hpp:46
Half * GetOutputTensorDataHalf(unsigned int idx, const PayloadType &data)
Copyright (c) 2021 ARM Limited and Contributors.
#define ARMNN_SCOPED_PROFILING_EVENT(backendId, name)
Definition: Profiling.hpp:173
static void ConvertFloat32To16(const float *srcFloat32Buffer, size_t numElements, void *dstFloat16Buffer)
Converts a buffer of FP32 values to FP16, and stores in the given dstFloat16Buffer.
std::vector< ITensorHandle * > m_Inputs
half_float::half Half
Definition: Half.hpp:16
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
unsigned int GetNumElements() const
Definition: Tensor.hpp:192