pub enum PruningError {
NumericalInstability {
method: String,
details: String,
},
CalibrationRequired {
method: String,
},
ShapeMismatch {
expected: Vec<usize>,
got: Vec<usize>,
},
InvalidMask {
reason: String,
},
InvalidPattern {
message: String,
},
MissingActivationStats {
layer: String,
},
InvalidSparsity {
value: f32,
constraint: String,
},
NoParameters {
module: String,
},
}Expand description
Pruning operation errors with detailed context.
§Toyota Way: Andon
Errors contain actionable information for diagnosis. Each variant provides specific context to help identify and resolve issues quickly.
Variants§
NumericalInstability
Numerical instability detected (NaN/Inf in scores).
§Jidoka Principle
Stop immediately when numerical issues are detected rather than propagating bad values downstream.
Fields
CalibrationRequired
Calibration data required but not provided.
Methods like Wanda require activation statistics from calibration data to compute importance scores.
ShapeMismatch
Tensor shape mismatch.
Occurs when mask and weight tensor shapes don’t align.
InvalidMask
Invalid sparsity mask.
Masks must contain only binary values (0.0 or 1.0).
InvalidPattern
Invalid sparsity pattern configuration.
For N:M patterns, N must be less than M.
MissingActivationStats
Missing activation statistics for a layer.
The calibration context doesn’t have stats for this layer.
InvalidSparsity
Invalid sparsity target.
Sparsity must be in range [0.0, 1.0].
NoParameters
Module has no parameters to prune.
Trait Implementations§
Source§impl Clone for PruningError
impl Clone for PruningError
Source§fn clone(&self) -> PruningError
fn clone(&self) -> PruningError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PruningError
impl Debug for PruningError
Source§impl Display for PruningError
impl Display for PruningError
Source§impl Error for PruningError
impl Error for PruningError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for PruningError
impl RefUnwindSafe for PruningError
impl Send for PruningError
impl Sync for PruningError
impl Unpin for PruningError
impl UnsafeUnpin for PruningError
impl UnwindSafe for PruningError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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