pub enum SrcDtype {
F32,
F16,
BF16,
}Expand description
Source dtype for a weight tensor read straight from safetensors mmap.
Passed to Backend::from_weight_bytes so each backend can choose whether
to upcast to its compute dtype or store as-is.
Variants§
Implementations§
Source§impl SrcDtype
impl SrcDtype
Sourcepub const fn bytes_per_elem(self) -> usize
pub const fn bytes_per_elem(self) -> usize
Number of bytes per element in the raw on-disk representation.
Sourcepub fn to_f32_vec(self, raw: &[u8]) -> Vec<f32>
pub fn to_f32_vec(self, raw: &[u8]) -> Vec<f32>
Materialise the raw byte slice into a Vec<f32>. Used by the default
Backend::from_weight_bytes impl; fp16-preferring backends bypass it.
Trait Implementations§
impl Copy for SrcDtype
impl Eq for SrcDtype
impl StructuralPartialEq for SrcDtype
Auto Trait Implementations§
impl Freeze for SrcDtype
impl RefUnwindSafe for SrcDtype
impl Send for SrcDtype
impl Sync for SrcDtype
impl Unpin for SrcDtype
impl UnsafeUnpin for SrcDtype
impl UnwindSafe for SrcDtype
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