HDK
|
bfloat16 (Brain Floating Point) data type More...
#include <onnxruntime_cxx_api.h>
Public Types | |
using | Base = onnxruntime_float16::BFloat16Impl< BFloat16_t > |
Public Member Functions | |
BFloat16_t ()=default | |
BFloat16_t (float v) noexcept | |
__ctor from float. Float is converted into bfloat16 16-bit representation. More... | |
float | ToFloat () const noexcept |
Converts bfloat16 to float More... | |
operator float () const noexcept | |
User defined conversion operator. Converts BFloat16_t to float. More... | |
bool | operator== (const BFloat16_t &rhs) const noexcept |
bool | operator!= (const BFloat16_t &rhs) const noexcept |
bool | operator< (const BFloat16_t &rhs) const noexcept |
Public Member Functions inherited from onnxruntime_float16::BFloat16Impl< BFloat16_t > | |
BFloat16Impl ()=default | |
bool | IsNegative () const noexcept |
Checks if the value is negative More... | |
bool | IsNaN () const noexcept |
Tests if the value is NaN More... | |
bool | IsFinite () const noexcept |
Tests if the value is finite More... | |
bool | IsPositiveInfinity () const noexcept |
Tests if the value represents positive infinity. More... | |
bool | IsNegativeInfinity () const noexcept |
Tests if the value represents negative infinity More... | |
bool | IsInfinity () const noexcept |
Tests if the value is either positive or negative infinity. More... | |
bool | IsNaNOrZero () const noexcept |
Tests if the value is NaN or zero. Useful for comparisons. More... | |
bool | IsNormal () const noexcept |
Tests if the value is normal (not zero, subnormal, infinite, or NaN). More... | |
bool | IsSubnormal () const noexcept |
Tests if the value is subnormal (denormal). More... | |
BFloat16_t | Abs () const noexcept |
Creates an instance that represents absolute value. More... | |
BFloat16_t | Negate () const noexcept |
Creates a new instance with the sign flipped. More... | |
Static Public Member Functions | |
static constexpr BFloat16_t | FromBits (uint16_t v) noexcept |
Explicit conversion to uint16_t representation of bfloat16. More... | |
Static Public Member Functions inherited from onnxruntime_float16::BFloat16Impl< BFloat16_t > | |
static bool | AreZero (const BFloat16Impl &lhs, const BFloat16Impl &rhs) noexcept |
IEEE defines that positive and negative zero are equal, this gives us a quick equality check for two values by or'ing the private bits together and stripping the sign. They are both zero, and therefore equivalent, if the resulting value is still zero. More... | |
Additional Inherited Members | |
Public Attributes inherited from onnxruntime_float16::BFloat16Impl< BFloat16_t > | |
uint16_t | val |
Static Public Attributes inherited from onnxruntime_float16::BFloat16Impl< BFloat16_t > | |
static constexpr uint16_t | kSignMask |
static constexpr uint16_t | kBiasedExponentMask |
static constexpr uint16_t | kPositiveInfinityBits |
static constexpr uint16_t | kNegativeInfinityBits |
static constexpr uint16_t | kPositiveQNaNBits |
static constexpr uint16_t | kNegativeQNaNBits |
static constexpr uint16_t | kSignaling_NaNBits |
static constexpr uint16_t | kEpsilonBits |
static constexpr uint16_t | kMinValueBits |
static constexpr uint16_t | kMaxValueBits |
static constexpr uint16_t | kRoundToNearest |
static constexpr uint16_t | kOneBits |
static constexpr uint16_t | kMinusOneBits |
Protected Member Functions inherited from onnxruntime_float16::BFloat16Impl< BFloat16_t > | |
float | ToFloatImpl () const noexcept |
Converts bfloat16 to float More... | |
uint16_t | AbsImpl () const noexcept |
Creates an instance that represents absolute value. More... | |
uint16_t | NegateImpl () const noexcept |
Creates a new instance with the sign flipped. More... | |
Static Protected Member Functions inherited from onnxruntime_float16::BFloat16Impl< BFloat16_t > | |
static uint16_t | ToUint16Impl (float v) noexcept |
Converts from float to uint16_t float16 representation More... | |
bfloat16 (Brain Floating Point) data type
This struct is used for converting float to bfloat16 and back so the user could feed inputs and fetch outputs using these type.
The size of the structure should align with uint16_t and one can freely cast uint16_t buffers to/from Ort::BFloat16_t to feed and retrieve data.
Definition at line 306 of file onnxruntime_cxx_api.h.
Definition at line 318 of file onnxruntime_cxx_api.h.
|
default |
|
inlineexplicitnoexcept |
__ctor from float. Float is converted into bfloat16 16-bit representation.
v | float value |
Definition at line 333 of file onnxruntime_cxx_api.h.
|
inlinestaticnoexcept |
Explicit conversion to uint16_t representation of bfloat16.
v | uint16_t bit representation of bfloat16 |
Definition at line 327 of file onnxruntime_cxx_api.h.
|
inlineexplicitnoexcept |
User defined conversion operator. Converts BFloat16_t to float.
Definition at line 420 of file onnxruntime_cxx_api.h.
|
inlinenoexcept |
Definition at line 425 of file onnxruntime_cxx_api.h.
|
inlinenoexcept |
Definition at line 153 of file onnxruntime_cxx_inline.h.
|
inlinenoexcept |
Definition at line 145 of file onnxruntime_cxx_inline.h.
|
inlinenoexcept |
Converts bfloat16 to float
Definition at line 339 of file onnxruntime_cxx_api.h.