pub struct MagnitudePruner { /* private fields */ }Expand description
Magnitude-based pruner: zero out elements with smallest absolute values.
Implementations§
Source§impl MagnitudePruner
impl MagnitudePruner
Sourcepub fn new(config: PruningConfig) -> Self
pub fn new(config: PruningConfig) -> Self
Create a new magnitude pruner with the given config.
Sourcepub fn prune_2d(
&self,
matrix: &mut Array2<f64>,
) -> Result<SparsityStats, PruningError>
pub fn prune_2d( &self, matrix: &mut Array2<f64>, ) -> Result<SparsityStats, PruningError>
Prune a 2D matrix in-place according to the pattern.
Sourcepub fn prune(
&self,
tensor: &mut ArrayD<f64>,
) -> Result<SparsityStats, PruningError>
pub fn prune( &self, tensor: &mut ArrayD<f64>, ) -> Result<SparsityStats, PruningError>
Prune a general N-D tensor (applies unstructured or falls back to 2D for structured patterns).
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> 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