ArmNN
 21.02
Float32ToFloat16 Struct Reference

#include <ConvertConstants.hpp>

Static Public Member Functions

static void Func (std::unique_ptr< ScopedCpuTensorHandle > &handle)
 

Detailed Description

Definition at line 87 of file ConvertConstants.hpp.

Member Function Documentation

◆ Func()

static void Func ( std::unique_ptr< ScopedCpuTensorHandle > &  handle)
inlinestatic

Definition at line 89 of file ConvertConstants.hpp.

References FloatingPointConverter::ConvertFloat32To16(), armnn::Float16, armnn::Float32, TensorInfo::GetDataType(), TensorInfo::GetNumElements(), TensorInfo::GetShape(), and armnn::info.

90  {
91  const TensorInfo& info = handle->GetTensorInfo();
92 
93  if (info.GetDataType() == DataType::Float32)
94  {
95  std::vector<Half> newValues(info.GetNumElements());
96 
98  info.GetNumElements(),
99  newValues.data());
100 
101  TensorInfo newInfo(info.GetShape(), DataType::Float16);
102  ConstTensor newInput(newInfo, newValues);
103  handle.reset(new ScopedCpuTensorHandle(newInput));
104  }
105  }
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.

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