ArmNN
 21.02
Float32ToBFloat16 Struct Reference

#include <ConvertConstants.hpp>

Static Public Member Functions

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

Detailed Description

Definition at line 66 of file ConvertConstants.hpp.

Member Function Documentation

◆ Func()

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

Definition at line 68 of file ConvertConstants.hpp.

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

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

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