ArmNN
 25.02
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RefConvertFp32ToFp16Workload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017-2024 Arm Ltd and Contributors. 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 {
20 }
21 
22 
23 void RefConvertFp32ToFp16Workload::Execute(std::vector<ITensorHandle*> inputs,
24  std::vector<ITensorHandle*> outputs) const
25 {
26  ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefConvertFp32ToFp16Workload_Execute");
27 
28  const float* const input = reinterpret_cast<const float*>(inputs[0]->Map());
29  Half* const output = reinterpret_cast<Half*>(outputs[0]->Map());
30 
31  // convert Fp32 input to Fp16 output
32  unsigned int numElements = GetTensorInfo(inputs[0]).GetNumElements();
34 }
35 
36 } //namespace armnn
#define ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
QueueDescriptor m_Data
Definition: Workload.hpp:74
unsigned int GetNumElements() const
Definition: Tensor.hpp:198
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.
Copyright (c) 2021 ARM Limited and Contributors.
half_float::half Half
Definition: Half.hpp:22
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
std::vector< ITensorHandle * > m_Inputs
std::vector< ITensorHandle * > m_Outputs