pub struct MagnitudePruner { /* private fields */ }Expand description
Simple magnitude-based pruner.
Uses weight magnitude as importance and generates masks to achieve the target sparsity by pruning the smallest weights.
Implementations§
Trait Implementations§
Source§impl Clone for MagnitudePruner
impl Clone for MagnitudePruner
Source§fn clone(&self) -> MagnitudePruner
fn clone(&self) -> MagnitudePruner
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 MagnitudePruner
impl Debug for MagnitudePruner
Source§impl Default for MagnitudePruner
impl Default for MagnitudePruner
Source§impl Pruner for MagnitudePruner
impl Pruner for MagnitudePruner
Source§fn generate_mask(
&self,
scores: &ImportanceScores,
target_sparsity: f32,
pattern: SparsityPattern,
) -> Result<SparsityMask, PruningError>
fn generate_mask( &self, scores: &ImportanceScores, target_sparsity: f32, pattern: SparsityPattern, ) -> Result<SparsityMask, PruningError>
Generate a sparsity mask based on importance scores. Read more
Source§fn apply_mask(
&self,
module: &mut dyn Module,
mask: &SparsityMask,
) -> Result<PruningResult, PruningError>
fn apply_mask( &self, module: &mut dyn Module, mask: &SparsityMask, ) -> Result<PruningResult, PruningError>
Apply a sparsity mask to a module, zeroing pruned weights. Read more
Source§fn importance(&self) -> &dyn Importance
fn importance(&self) -> &dyn Importance
Get the importance estimator used by this pruner.
Auto Trait Implementations§
impl Freeze for MagnitudePruner
impl RefUnwindSafe for MagnitudePruner
impl Send for MagnitudePruner
impl Sync for MagnitudePruner
impl Unpin for MagnitudePruner
impl UnsafeUnpin for MagnitudePruner
impl UnwindSafe for MagnitudePruner
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