pub struct CompressionResult {
pub compressed_tensors: Vec<WeightTensor>,
pub stage_stats: Vec<StageStats>,
}Expand description
The outcome of running the full compression pipeline.
Fields§
§compressed_tensors: Vec<WeightTensor>The compressed (and possibly sparsified) tensors in the original order.
stage_stats: Vec<StageStats>One StageStats entry per stage in the pipeline.
Implementations§
Source§impl CompressionResult
impl CompressionResult
Sourcepub fn total_params(&self) -> usize
pub fn total_params(&self) -> usize
Total number of parameters across all compressed tensors.
Sourcepub fn total_nonzero(&self) -> usize
pub fn total_nonzero(&self) -> usize
Total number of non-zero parameters across all compressed tensors.
Sourcepub fn overall_sparsity(&self) -> f32
pub fn overall_sparsity(&self) -> f32
Overall sparsity (fraction of zero weights) across all compressed tensors.
Sourcepub fn total_compression_ratio(&self) -> f32
pub fn total_compression_ratio(&self) -> f32
Compression ratio: memory_before / memory_after using the first and last
stage’s memory stats. Falls back to 1.0 if there are no stages.
Sourcepub fn memory_before_bytes(&self) -> usize
pub fn memory_before_bytes(&self) -> usize
Memory (bytes) before any compression: taken from the first stage’s
memory_before_bytes. Returns 0 if there are no stage stats.
Sourcepub fn memory_after_bytes(&self) -> usize
pub fn memory_after_bytes(&self) -> usize
Memory (bytes) after all compression: taken from the last stage’s
memory_after_bytes. Returns 0 if there are no stage stats.
Trait Implementations§
Source§impl Clone for CompressionResult
impl Clone for CompressionResult
Source§fn clone(&self) -> CompressionResult
fn clone(&self) -> CompressionResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CompressionResult
impl RefUnwindSafe for CompressionResult
impl Send for CompressionResult
impl Sync for CompressionResult
impl Unpin for CompressionResult
impl UnsafeUnpin for CompressionResult
impl UnwindSafe for CompressionResult
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
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>
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>
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