#[repr(transparent)]pub struct BFloat16(pub u16);Expand description
Brain Floating Point 16 (__nv_bfloat16 in CUDA). The top 16 bits of an IEEE 754 f32.
Tuple Fields§
§0: u16Implementations§
Source§impl BFloat16
impl BFloat16
pub const ZERO: Self
pub const NEG_ZERO: Self
pub const ONE: Self
pub const NEG_ONE: Self
pub const INFINITY: Self
pub const NEG_INFINITY: Self
pub const NAN: Self
pub const MIN_POSITIVE: Self
pub const MAX: Self
pub const MIN: Self
pub const EPSILON: Self
pub const fn from_bits(bits: u16) -> Self
pub const fn to_bits(self) -> u16
pub const fn is_nan(self) -> bool
pub const fn is_infinite(self) -> bool
pub const fn is_sign_negative(self) -> bool
Sourcepub fn from_f32(f: f32) -> Self
pub fn from_f32(f: f32) -> Self
Round-to-nearest-even conversion from f32 (matches NVIDIA’s bfloat16 truncation + rounding).
pub fn to_f32(self) -> f32
Trait Implementations§
Source§impl PartialOrd for BFloat16
impl PartialOrd for BFloat16
impl Copy for BFloat16
impl DeviceRepr for BFloat16
impl Eq for BFloat16
impl StructuralPartialEq for BFloat16
impl ValidAsZeroBits for BFloat16
Auto Trait Implementations§
impl Freeze for BFloat16
impl RefUnwindSafe for BFloat16
impl Send for BFloat16
impl Sync for BFloat16
impl Unpin for BFloat16
impl UnsafeUnpin for BFloat16
impl UnwindSafe for BFloat16
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more