ArmNN
 25.11
Loading...
Searching...
No Matches
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
8#include "Profiling.hpp"
9
11
12#include <Half.hpp>
13
14namespace armnn
15{
16
18{
19 Execute(m_Data.m_Inputs, m_Data.m_Outputs);
20}
21
22
23void 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
armnn::TensorInfo GetTensorInfo(unsigned int numberOfBatches, unsigned int numberOfChannels, unsigned int height, unsigned int width, const armnn::DataLayout dataLayout, const armnn::DataType dataType)