ArmNN
 21.02
BFloat16ToFloat32 Struct Reference

#include <ConvertConstants.hpp>

Static Public Member Functions

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

Detailed Description

Definition at line 24 of file ConvertConstants.hpp.

Member Function Documentation

◆ Func()

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

Definition at line 26 of file ConvertConstants.hpp.

References armnn::BFloat16, FloatingPointConverter::ConvertBFloat16ToFloat32(), armnn::Float32, TensorInfo::GetDataType(), TensorInfo::GetNumElements(), TensorInfo::GetShape(), and armnn::info.

27  {
28  const TensorInfo& info = handle->GetTensorInfo();
29 
30  if (info.GetDataType() == DataType::BFloat16)
31  {
32  std::vector<float> newValues(info.GetNumElements());
33 
35  info.GetNumElements(),
36  newValues.data());
37 
38  TensorInfo newInfo(info.GetShape(), DataType::Float32);
39  ConstTensor newInput(newInfo, newValues);
40  handle.reset(new ScopedCpuTensorHandle(newInput));
41  }
42  }
static void ConvertBFloat16ToFloat32(const void *srcBFloat16Buffer, size_t numElements, float *dstFloat32Buffer)

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