pub enum StoredDtype {
Bf16,
F32,
Q8,
Q4,
}Expand description
How a tensor’s elements are stored in the container.
Narrow on purpose, and unknown values are refused. The high-precision variants exist because the quant recipe protects norms, codebooks, and the speaker path — an artifact that claims a dtype we have never conformed is a refusal, not a best-effort read.
Variants§
Bf16
bfloat16, kept verbatim from the checkpoint.
F32
32-bit float.
Q8
int8 with separate per-group scales.
Q4
int4, two elements per byte, with separate per-group scales.
Implementations§
Source§impl StoredDtype
impl StoredDtype
Sourcepub const fn storage_bytes(self, elements: u64) -> Option<u64>
pub const fn storage_bytes(self, elements: u64) -> Option<u64>
Storage bytes for elements values, or None on overflow.
Q4 packs two elements per byte and rounds up, so an odd element count still occupies a whole trailing byte.
Trait Implementations§
Source§impl Clone for StoredDtype
impl Clone for StoredDtype
Source§fn clone(&self) -> StoredDtype
fn clone(&self) -> StoredDtype
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for StoredDtype
Source§impl Debug for StoredDtype
impl Debug for StoredDtype
Source§impl Display for StoredDtype
impl Display for StoredDtype
impl Eq for StoredDtype
Source§impl Ord for StoredDtype
impl Ord for StoredDtype
Source§fn cmp(&self, other: &StoredDtype) -> Ordering
fn cmp(&self, other: &StoredDtype) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for StoredDtype
impl PartialEq for StoredDtype
Source§impl PartialOrd for StoredDtype
impl PartialOrd for StoredDtype
impl StructuralPartialEq for StoredDtype
Auto Trait Implementations§
impl Freeze for StoredDtype
impl RefUnwindSafe for StoredDtype
impl Send for StoredDtype
impl Sync for StoredDtype
impl Unpin for StoredDtype
impl UnsafeUnpin for StoredDtype
impl UnwindSafe for StoredDtype
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