pub struct PruningMetadata { /* private fields */ }Expand description
Pruning metadata tracking which elements/blocks are pruned
Implementations§
Source§impl PruningMetadata
impl PruningMetadata
Sourcepub fn new(
strategy: PruningStrategy,
original_shape: Shape,
achieved_sparsity: f32,
) -> Self
pub fn new( strategy: PruningStrategy, original_shape: Shape, achieved_sparsity: f32, ) -> Self
Create new pruning metadata
Sourcepub fn with_indices(self, indices: Vec<usize>) -> Self
pub fn with_indices(self, indices: Vec<usize>) -> Self
Set pruned indices for unstructured pruning
Sourcepub fn with_blocks(self, blocks: Vec<(usize, usize)>) -> Self
pub fn with_blocks(self, blocks: Vec<(usize, usize)>) -> Self
Set pruned blocks for structured pruning
Sourcepub fn with_channels(self, channels: Vec<usize>) -> Self
pub fn with_channels(self, channels: Vec<usize>) -> Self
Set pruned channels
Sourcepub fn with_threshold(self, threshold: f32) -> Self
pub fn with_threshold(self, threshold: f32) -> Self
Set threshold value
Sourcepub fn strategy(&self) -> PruningStrategy
pub fn strategy(&self) -> PruningStrategy
Get pruning strategy
Sourcepub fn compression_ratio(&self) -> f32
pub fn compression_ratio(&self) -> f32
Get compression ratio
Sourcepub fn num_pruned_elements(&self) -> usize
pub fn num_pruned_elements(&self) -> usize
Get number of pruned elements
Sourcepub fn is_element_pruned(&self, index: usize) -> bool
pub fn is_element_pruned(&self, index: usize) -> bool
Check if an element is pruned
Sourcepub fn memory_savings(&self, dtype: DType) -> usize
pub fn memory_savings(&self, dtype: DType) -> usize
Get memory savings in bytes
Trait Implementations§
Source§impl Clone for PruningMetadata
impl Clone for PruningMetadata
Source§fn clone(&self) -> PruningMetadata
fn clone(&self) -> PruningMetadata
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 moreAuto Trait Implementations§
impl !Freeze for PruningMetadata
impl RefUnwindSafe for PruningMetadata
impl Send for PruningMetadata
impl Sync for PruningMetadata
impl Unpin for PruningMetadata
impl UnsafeUnpin for PruningMetadata
impl UnwindSafe for PruningMetadata
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> 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