ArmNN
 25.11
Loading...
Searching...
No Matches
Float32ToFloat16 Struct Reference

#include <ConvertConstants.hpp>

Static Public Member Functions

static void Func (std::shared_ptr< ConstTensorHandle > &handle)

Detailed Description

Definition at line 42 of file ConvertConstants.hpp.

Member Function Documentation

◆ Func()

void Func ( std::shared_ptr< ConstTensorHandle > & handle)
inlinestatic

Definition at line 44 of file ConvertConstants.hpp.

45 {
46 const TensorInfo& info = handle->GetTensorInfo();
47
48 if (info.GetDataType() == DataType::Float32)
49 {
50 std::vector<Half> newValues(info.GetNumElements());
51
52 armnnUtils::FloatingPointConverter::ConvertFloat32To16(handle->GetConstTensor<float>(),
53 info.GetNumElements(),
54 newValues.data());
55
56 TensorInfo newInfo(info.GetShape(), DataType::Float16, 0.0f, 0, true);
57 ConstTensor newInput(newInfo, newValues);
58 handle.reset(new ScopedTensorHandle(newInput));
59 }
60 }
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.

References FloatingPointConverter::ConvertFloat32To16(), armnn::Float16, armnn::Float32, and armnn::info.


The documentation for this struct was generated from the following file: