pub struct StructuredPruner { /* private fields */ }Expand description
Structured pruning (remove entire neurons/channels/filters).
Implementations§
Source§impl StructuredPruner
impl StructuredPruner
Sourcepub fn new(config: PruningConfig, axis: StructuredPruningAxis) -> Self
pub fn new(config: PruningConfig, axis: StructuredPruningAxis) -> Self
Create a new structured pruner.
Trait Implementations§
Source§impl Pruner for StructuredPruner
impl Pruner for StructuredPruner
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 StructuredPruner
impl RefUnwindSafe for StructuredPruner
impl Send for StructuredPruner
impl Sync for StructuredPruner
impl Unpin for StructuredPruner
impl UnwindSafe for StructuredPruner
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