pub struct QuantizationStats {
pub layers_quantized: usize,
pub layers_skipped: usize,
pub original_params: usize,
pub quantized_params: usize,
pub original_bytes: usize,
pub quantized_bytes: usize,
pub average_sparsity: f32,
pub layer_sparsities: HashMap<String, f32>,
/* private fields */
}Expand description
Statistics from model quantization.
Fields§
§layers_quantized: usizeNumber of layers quantized to ternary
layers_skipped: usizeNumber of layers skipped (non-linear or below threshold)
original_params: usizeTotal parameters in original model (computed by finalize_stats())
quantized_params: usizeTotal parameters in quantized model (as ternary)
original_bytes: usizeOriginal model size in bytes (FP32, computed by finalize_stats())
quantized_bytes: usizeTotal model size in bytes (includes both quantized and preserved layers)
average_sparsity: f32Average sparsity across quantized layers
layer_sparsities: HashMap<String, f32>Per-layer sparsity
Implementations§
Source§impl QuantizationStats
impl QuantizationStats
Sourcepub fn compression_ratio(&self) -> f32
pub fn compression_ratio(&self) -> f32
Compression ratio (original / quantized).
§Returns
Returns 1.0 (no compression) if quantized_bytes is zero, indicating
no quantization occurred. Otherwise returns original_bytes / quantized_bytes.
Sourcepub fn print_summary(&self)
pub fn print_summary(&self)
Print summary statistics.
Trait Implementations§
Source§impl Clone for QuantizationStats
impl Clone for QuantizationStats
Source§fn clone(&self) -> QuantizationStats
fn clone(&self) -> QuantizationStats
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for QuantizationStats
impl Debug for QuantizationStats
Source§impl Default for QuantizationStats
impl Default for QuantizationStats
Source§fn default() -> QuantizationStats
fn default() -> QuantizationStats
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for QuantizationStats
impl RefUnwindSafe for QuantizationStats
impl Send for QuantizationStats
impl Sync for QuantizationStats
impl Unpin for QuantizationStats
impl UnwindSafe for QuantizationStats
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