pub struct DynQuantTensor {
pub data: Vec<i8>,
pub scales: Vec<f32>,
pub shape: Vec<usize>,
pub format: DynQuantFormat,
}Expand description
A dynamically quantized tensor.
Fields§
§data: Vec<i8>Quantized values (i8 storage for both INT8 and INT4).
scales: Vec<f32>Scales, one per quantization group.
shape: Vec<usize>Shape of the original tensor.
format: DynQuantFormatQuantization format.
Implementations§
Source§impl DynQuantTensor
impl DynQuantTensor
Sourcepub fn dequantize(&self) -> Vec<f32>
pub fn dequantize(&self) -> Vec<f32>
Dequantize back to f32.
Sourcepub fn memory_bytes(&self) -> usize
pub fn memory_bytes(&self) -> usize
Memory in bytes (data + scales).
Sourcepub fn compression_ratio(&self) -> f32
pub fn compression_ratio(&self) -> f32
Compression ratio vs f32 (data only, excluding scales).
Sourcepub fn element_count(&self) -> usize
pub fn element_count(&self) -> usize
Number of elements.
Trait Implementations§
Source§impl Clone for DynQuantTensor
impl Clone for DynQuantTensor
Source§fn clone(&self) -> DynQuantTensor
fn clone(&self) -> DynQuantTensor
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 moreAuto Trait Implementations§
impl Freeze for DynQuantTensor
impl RefUnwindSafe for DynQuantTensor
impl Send for DynQuantTensor
impl Sync for DynQuantTensor
impl Unpin for DynQuantTensor
impl UnsafeUnpin for DynQuantTensor
impl UnwindSafe for DynQuantTensor
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more