ArmNN
 22.11
BFloat16ToFloat32 Struct Reference

#include <ConvertConstants.hpp>

Static Public Member Functions

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

Detailed Description

Definition at line 22 of file ConvertConstants.hpp.

Member Function Documentation

◆ Func()

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

Definition at line 24 of file ConvertConstants.hpp.

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

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

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