pub struct MagnitudePruner { /* private fields */ }Expand description
Magnitude-based pruning (prune smallest weights).
Implementations§
Source§impl MagnitudePruner
impl MagnitudePruner
Sourcepub fn new(config: PruningConfig) -> Self
pub fn new(config: PruningConfig) -> Self
Create a new magnitude-based pruner.
Trait Implementations§
Source§impl Pruner for MagnitudePruner
impl Pruner for MagnitudePruner
Source§fn prune(
&self,
weights: &Array2<f64>,
) -> TrainResult<(Array2<f64>, PruningMask)>
fn prune( &self, weights: &Array2<f64>, ) -> TrainResult<(Array2<f64>, PruningMask)>
Prune weights and return pruned weights and mask.
Source§fn generate_mask(&self, weights: &Array2<f64>) -> TrainResult<PruningMask>
fn generate_mask(&self, weights: &Array2<f64>) -> TrainResult<PruningMask>
Generate pruning mask without modifying weights.
Source§fn apply_mask(
&self,
weights: &Array2<f64>,
mask: &PruningMask,
) -> TrainResult<Array2<f64>>
fn apply_mask( &self, weights: &Array2<f64>, mask: &PruningMask, ) -> TrainResult<Array2<f64>>
Apply existing mask to weights.
Source§fn config(&self) -> &PruningConfig
fn config(&self) -> &PruningConfig
Get pruning configuration.
Source§fn update_ratio(&mut self, iteration: usize)
fn update_ratio(&mut self, iteration: usize)
Update pruning ratio for iterative pruning.
Auto Trait Implementations§
impl Freeze for MagnitudePruner
impl RefUnwindSafe for MagnitudePruner
impl Send for MagnitudePruner
impl Sync for MagnitudePruner
impl Unpin 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> 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