pub struct ModelCompressionMetrics {
pub layers: Vec<CompressionMetrics>,
pub names: Vec<String>,
}Expand description
Aggregated compression statistics over an entire model.
Fields§
§layers: Vec<CompressionMetrics>Per-layer metrics.
names: Vec<String>Per-layer names.
Implementations§
Source§impl ModelCompressionMetrics
impl ModelCompressionMetrics
Sourcepub fn add_layer(&mut self, name: impl Into<String>, m: CompressionMetrics)
pub fn add_layer(&mut self, name: impl Into<String>, m: CompressionMetrics)
Add a layer’s metrics.
Sourcepub fn total_parameters(&self) -> u64
pub fn total_parameters(&self) -> u64
Total number of parameters across all layers.
Sourcepub fn model_compression_ratio(&self) -> f32
pub fn model_compression_ratio(&self) -> f32
Model-wide compression ratio (total original bits / total compressed bits).
Sourcepub fn mean_quantization_mse(&self) -> f32
pub fn mean_quantization_mse(&self) -> f32
Weighted average quantization MSE across all layers.
Sourcepub fn average_effective_bits(&self) -> f32
pub fn average_effective_bits(&self) -> f32
Average effective bits per parameter across all layers (parameter-weighted).
Sourcepub fn add_quantized_layer(
&mut self,
name: impl Into<String>,
weights: &[f32],
quant_bits: u32,
quantization_mse: f32,
) -> QuantResult<()>
pub fn add_quantized_layer( &mut self, name: impl Into<String>, weights: &[f32], quant_bits: u32, quantization_mse: f32, ) -> QuantResult<()>
Compute the MSE for a quantized layer inline and add it.
This is a convenience method to avoid pre-computing MSE externally.
§Errors
Returns crate::error::QuantError::EmptyInput if weights is empty.
Trait Implementations§
Source§impl Clone for ModelCompressionMetrics
impl Clone for ModelCompressionMetrics
Source§fn clone(&self) -> ModelCompressionMetrics
fn clone(&self) -> ModelCompressionMetrics
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 ModelCompressionMetrics
impl Debug for ModelCompressionMetrics
Source§impl Default for ModelCompressionMetrics
impl Default for ModelCompressionMetrics
Source§fn default() -> ModelCompressionMetrics
fn default() -> ModelCompressionMetrics
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ModelCompressionMetrics
impl RefUnwindSafe for ModelCompressionMetrics
impl Send for ModelCompressionMetrics
impl Sync for ModelCompressionMetrics
impl Unpin for ModelCompressionMetrics
impl UnsafeUnpin for ModelCompressionMetrics
impl UnwindSafe for ModelCompressionMetrics
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