pub struct LotteryTicketConfig {
pub target_sparsity: f32,
pub pruning_rounds: usize,
pub rewind_strategy: RewindStrategy,
pub prune_rate_per_round: f32,
pub global_pruning: bool,
}Expand description
Configuration for Lottery Ticket pruning.
Fields§
§target_sparsity: f32Target sparsity (fraction of weights to prune, 0.0-1.0).
pruning_rounds: usizeNumber of iterative pruning rounds. Each round prunes a fraction, accumulating to target_sparsity.
rewind_strategy: RewindStrategyStrategy for rewinding weights after each pruning round.
prune_rate_per_round: f32Pruning rate per round (computed from target_sparsity and rounds). p_per_round = 1 - (1 - target_sparsity)^(1/rounds)
global_pruning: boolWhether to use global pruning (across all layers) or per-layer.
Implementations§
Source§impl LotteryTicketConfig
impl LotteryTicketConfig
Sourcepub fn new(target_sparsity: f32, pruning_rounds: usize) -> Self
pub fn new(target_sparsity: f32, pruning_rounds: usize) -> Self
Create a new configuration.
§Arguments
target_sparsity- Final sparsity (0.0-1.0), e.g., 0.9 = 90% prunedpruning_rounds- Number of iterative pruning rounds
Sourcepub fn with_rewind_strategy(self, strategy: RewindStrategy) -> Self
pub fn with_rewind_strategy(self, strategy: RewindStrategy) -> Self
Set the rewind strategy.
Sourcepub fn with_global_pruning(self, global: bool) -> Self
pub fn with_global_pruning(self, global: bool) -> Self
Enable or disable global pruning.
Trait Implementations§
Source§impl Clone for LotteryTicketConfig
impl Clone for LotteryTicketConfig
Source§fn clone(&self) -> LotteryTicketConfig
fn clone(&self) -> LotteryTicketConfig
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 LotteryTicketConfig
impl Debug for LotteryTicketConfig
Auto Trait Implementations§
impl Freeze for LotteryTicketConfig
impl RefUnwindSafe for LotteryTicketConfig
impl Send for LotteryTicketConfig
impl Sync for LotteryTicketConfig
impl Unpin for LotteryTicketConfig
impl UnsafeUnpin for LotteryTicketConfig
impl UnwindSafe for LotteryTicketConfig
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> 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