ArmNN
 24.08
RefConvertFp32ToFp16Workload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017-2023 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 
23 {
24  WorkingMemDescriptor* workingMemDescriptor = static_cast<WorkingMemDescriptor*>(executionData.m_Data);
25  Execute(workingMemDescriptor->m_Inputs, workingMemDescriptor->m_Outputs);
26 }
27 
28 void RefConvertFp32ToFp16Workload::Execute(std::vector<ITensorHandle*> inputs,
29  std::vector<ITensorHandle*> outputs) const
30 {
31  ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefConvertFp32ToFp16Workload_Execute");
32 
33  const float* const input = reinterpret_cast<const float*>(inputs[0]->Map());
34  Half* const output = reinterpret_cast<Half*>(outputs[0]->Map());
35 
36  // convert Fp32 input to Fp16 output
37  unsigned int numElements = GetTensorInfo(inputs[0]).GetNumElements();
39 }
40 
41 } //namespace armnn
armnn::TensorInfo::GetNumElements
unsigned int GetNumElements() const
Definition: Tensor.hpp:198
armnn::experimental::ExecutionData::m_Data
void * m_Data
Definition: ExecutionData.hpp:16
Profiling.hpp
armnn::RefConvertFp32ToFp16Workload::Execute
void Execute() const override
Definition: RefConvertFp32ToFp16Workload.cpp:17
ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: RefWorkloadUtils.hpp:22
armnn::Half
half_float::half Half
Definition: Half.hpp:22
armnn::GetTensorInfo
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
Definition: RefWorkloadUtils.hpp:33
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
RefConvertFp32ToFp16Workload.hpp
Half.hpp
RefWorkloadUtils.hpp
armnn::RefConvertFp32ToFp16Workload::ExecuteAsync
void ExecuteAsync(ExecutionData &executionData) override
Definition: RefConvertFp32ToFp16Workload.cpp:22
armnn::BaseWorkload::m_Data
QueueDescriptor m_Data
Definition: Workload.hpp:89
armnnUtils::FloatingPointConverter::ConvertFloat32To16
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.
Definition: FloatingPointConverter.cpp:17
FloatingPointConverter.hpp
armnn::experimental::WorkingMemDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkingMemDescriptor.hpp:20
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::experimental::WorkingMemDescriptor
Definition: WorkingMemDescriptor.hpp:18
armnn::experimental::WorkingMemDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkingMemDescriptor.hpp:21
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26
armnn::experimental::ExecutionData
Definition: ExecutionData.hpp:14