pub struct Quantizer;Expand description
Main quantizer for model compression.
Implementations§
Source§impl Quantizer
impl Quantizer
Sourcepub fn quantize_tensor(
tensor: &ArrayView2<'_, f32>,
config: &QuantizationConfig,
) -> QuantizedTensor
pub fn quantize_tensor( tensor: &ArrayView2<'_, f32>, config: &QuantizationConfig, ) -> QuantizedTensor
Sourcepub fn dequantize_tensor(quantized: &QuantizedTensor) -> Array2<f32>
pub fn dequantize_tensor(quantized: &QuantizedTensor) -> Array2<f32>
Sourcepub fn compression_ratio(config: &QuantizationConfig) -> f32
pub fn compression_ratio(config: &QuantizationConfig) -> f32
Computes the compression ratio achieved by quantization.
Sourcepub fn quantization_error(
original: &ArrayView2<'_, f32>,
quantized: &QuantizedTensor,
) -> f32
pub fn quantization_error( original: &ArrayView2<'_, f32>, quantized: &QuantizedTensor, ) -> f32
Estimates the quantization error (MSE) for a tensor.
Auto Trait Implementations§
impl Freeze for Quantizer
impl RefUnwindSafe for Quantizer
impl Send for Quantizer
impl Sync for Quantizer
impl Unpin for Quantizer
impl UnwindSafe for Quantizer
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> 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