ArmNN
 22.11
Float32ToBFloat16 Struct Reference

#include <ConvertConstants.hpp>

Static Public Member Functions

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

Detailed Description

Definition at line 64 of file ConvertConstants.hpp.

Member Function Documentation

◆ Func()

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

Definition at line 66 of file ConvertConstants.hpp.

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

67  {
68  const TensorInfo& info = handle->GetTensorInfo();
69 
70  if (info.GetDataType() == DataType::Float32)
71  {
72  std::vector<BFloat16> newValues(info.GetNumElements());
73 
75  info.GetNumElements(),
76  newValues.data());
77 
78  TensorInfo newInfo(info.GetShape(), DataType::BFloat16, 0.0f, 0, true);
79  ConstTensor newInput(newInfo, newValues);
80  handle.reset(new ScopedTensorHandle(newInput));
81  }
82  }
static void ConvertFloat32ToBFloat16(const float *srcFloat32Buffer, size_t numElements, void *dstBFloat16Buffer)

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