ArmNN
 22.05
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 {
20 }
21 
23 {
24  Execute(workingMemDescriptor.m_Inputs, workingMemDescriptor.m_Outputs);
25 }
26 
27 void RefConvertFp32ToFp16Workload::Execute(std::vector<ITensorHandle*> inputs,
28  std::vector<ITensorHandle*> outputs) const
29 {
30  ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefConvertFp32ToFp16Workload_Execute");
31 
32  const float* const input = reinterpret_cast<const float*>(inputs[0]->Map());
33  Half* const output = reinterpret_cast<Half*>(outputs[0]->Map());
34 
35  // convert Fp32 input to Fp16 output
36  unsigned int numElements = GetTensorInfo(inputs[0]).GetNumElements();
38 }
39 
40 } //namespace armnn
CPU Execution: Reference C++ kernels.
Copyright (c) 2021 ARM Limited and Contributors.
#define ARMNN_SCOPED_PROFILING_EVENT(backendId, name)
Definition: Profiling.hpp:220
QueueDescriptor m_Data
Definition: Workload.hpp:81
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.
void ExecuteAsync(WorkingMemDescriptor &workingMemDescriptor) override
std::vector< ITensorHandle * > m_Outputs
std::vector< ITensorHandle * > m_Inputs
half_float::half Half
Definition: Half.hpp:18
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
unsigned int GetNumElements() const
Definition: Tensor.hpp:196