pub struct ScaleGrid { /* private fields */ }Expand description
The scale of a scaled-float tensor (an FP8 checkpoint’s weight_scale_inv) broadcast over the weight’s elements, as
the Hugging Face converter’s dequant_simple broadcasts it before weight.float() * scale: with a block size, each
of the scale’s trailing axes repeated a block’s length and cropped to the weight’s; then axes of length 1 appended
until the scale has the weight’s rank, every axis either 1 (broadcast) or the weight’s length.
Implementations§
Source§impl ScaleGrid
impl ScaleGrid
Sourcepub fn new(
weight: &[usize],
dims: &[usize],
values: Vec<f32>,
block: Option<&[usize]>,
) -> Result<ScaleGrid, String>
pub fn new( weight: &[usize], dims: &[usize], values: Vec<f32>, block: Option<&[usize]>, ) -> Result<ScaleGrid, String>
The grid of a scale of axes dims and row-major values over a weight of axes weight, its trailing axes in
blocks of block where one is given. A shape dequant_simple would not broadcast is refused.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ScaleGrid
impl RefUnwindSafe for ScaleGrid
impl Send for ScaleGrid
impl Sync for ScaleGrid
impl Unpin for ScaleGrid
impl UnsafeUnpin for ScaleGrid
impl UnwindSafe for ScaleGrid
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.