ArmNN
 22.11
Float16ToFloat32 Struct Reference

#include <ConvertConstants.hpp>

Static Public Member Functions

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

Detailed Description

Definition at line 43 of file ConvertConstants.hpp.

Member Function Documentation

◆ Func()

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

Definition at line 45 of file ConvertConstants.hpp.

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

46  {
47  const TensorInfo& info = handle->GetTensorInfo();
48 
49  if (info.GetDataType() == DataType::Float16)
50  {
51  std::vector<float> newValues(info.GetNumElements());
52 
54  info.GetNumElements(),
55  newValues.data());
56 
57  TensorInfo newInfo(info.GetShape(), DataType::Float32, 0.0f, 0, true);
58  ConstTensor newInput(newInfo, newValues);
59  handle.reset(new ScopedTensorHandle(newInput));
60  }
61  }
half_float::half Half
Definition: Half.hpp:22
static void ConvertFloat16To32(const void *srcFloat16Buffer, size_t numElements, float *dstFloat32Buffer)

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