pub struct PruningConfig {
pub strategy: PruningStrategy,
pub granularity: PruningGranularity,
pub target_sparsity: f32,
pub global_threshold: bool,
pub num_iterations: usize,
pub keep_pruned_weights: bool,
}Expand description
Pruning configuration
Fields§
§strategy: PruningStrategyPruning strategy
granularity: PruningGranularityPruning granularity
target_sparsity: f32Target sparsity ratio (0.0 to 1.0)
global_threshold: boolWhether to use global threshold (vs per-layer)
num_iterations: usizeNumber of pruning iterations (for progressive pruning)
keep_pruned_weights: boolWhether to keep pruned weights for recovery
Implementations§
Source§impl PruningConfig
impl PruningConfig
Sourcepub fn new(strategy: PruningStrategy, target_sparsity: f32) -> Self
pub fn new(strategy: PruningStrategy, target_sparsity: f32) -> Self
Create new pruning configuration
Sourcepub fn with_granularity(self, granularity: PruningGranularity) -> Self
pub fn with_granularity(self, granularity: PruningGranularity) -> Self
Set granularity
Sourcepub fn with_global_threshold(self) -> Self
pub fn with_global_threshold(self) -> Self
Enable global thresholding
Sourcepub fn with_iterations(self, num_iterations: usize) -> Self
pub fn with_iterations(self, num_iterations: usize) -> Self
Set number of iterations for progressive pruning
Sourcepub fn with_keep_weights(self) -> Self
pub fn with_keep_weights(self) -> Self
Keep pruned weights
Sourcepub fn validate(&self) -> CoreResult<()>
pub fn validate(&self) -> CoreResult<()>
Validate configuration
Trait Implementations§
Source§impl Clone for PruningConfig
impl Clone for PruningConfig
Source§fn clone(&self) -> PruningConfig
fn clone(&self) -> PruningConfig
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 PruningConfig
impl Debug for PruningConfig
Source§impl Default for PruningConfig
impl Default for PruningConfig
Source§impl<'de> Deserialize<'de> for PruningConfig
impl<'de> Deserialize<'de> for PruningConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PruningConfig
impl RefUnwindSafe for PruningConfig
impl Send for PruningConfig
impl Sync for PruningConfig
impl Unpin for PruningConfig
impl UnwindSafe for PruningConfig
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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