pub enum Format {
Bf16,
F32,
I32,
Fp8E4m3 {
scale: Scale,
},
Nvfp4 {
group: u32,
},
}Expand description
2026-09-28: A tensor format.
Variants§
Bf16
2026-09-28: bfloat16.
F32
2026-09-28: float32.
I32
2026-09-28: int32 (token and expert ids).
Fp8E4m3
2026-09-28: FP8 E4M3 with the given scale layout.
Nvfp4
2026-09-28: NVFP4: E2M1 values, one E4M3 scale per group values, one F32 global.
Implementations§
Source§impl Format
impl Format
Sourcepub fn parse(s: &str) -> Result<Self, FormatError>
pub fn parse(s: &str) -> Result<Self, FormatError>
2026-09-28: Parse the canonical spelling, e.g. bf16, fp8/token, fp8/block128x128,
nvfp4/g16.
Sourcepub fn is_plain(&self) -> bool
pub fn is_plain(&self) -> bool
2026-09-28: True for an unquantized format (16/32-bit floats and int32).
Sourcepub fn is_edge_format(&self) -> bool
pub fn is_edge_format(&self) -> bool
2026-09-28: True when the scale layout is one an activation edge can carry.
Sourcepub fn weight_bytes(&self, n: u64, k: u64) -> Option<u64>
pub fn weight_bytes(&self, n: u64, k: u64) -> Option<u64>
2026-09-30: Bytes of a [n, k] weight in this format, scales included: as
Format::bytes, except that an NVFP4 weight has one F32 global scale for the whole
tensor (weight_scale_2), where an activation has one per row.
Trait Implementations§
Source§impl Ord for Format
impl Ord for Format
Source§impl PartialOrd for Format
impl PartialOrd for Format
impl Copy for Format
impl Eq for Format
impl StructuralPartialEq for Format
Auto Trait Implementations§
impl Freeze for Format
impl RefUnwindSafe for Format
impl Send for Format
impl Sync for Format
impl Unpin for Format
impl UnwindSafe for Format
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.