pub struct WarmupScheduler { /* private fields */ }Expand description
Linear warmup followed by another scheduler.
During warmup: lr = warmup_start_lr + (warmup_end_lr - warmup_start_lr) * (step / warmup_steps) After warmup: delegates to the inner scheduler.
Implementations§
Source§impl WarmupScheduler
impl WarmupScheduler
Sourcepub fn new(
warmup_steps: usize,
warmup_start_lr: f64,
warmup_end_lr: f64,
inner: Box<dyn LrSchedulerV2>,
) -> Result<Self, SchedulerError>
pub fn new( warmup_steps: usize, warmup_start_lr: f64, warmup_end_lr: f64, inner: Box<dyn LrSchedulerV2>, ) -> Result<Self, SchedulerError>
Create a new warmup scheduler wrapping an inner scheduler.
§Errors
Returns SchedulerError::InvalidConfig if warmup_steps is zero.
Trait Implementations§
Source§impl LrSchedulerV2 for WarmupScheduler
impl LrSchedulerV2 for WarmupScheduler
Source§fn current_lr(&self) -> f64
fn current_lr(&self) -> f64
Return the current learning rate without advancing.
Source§fn steps_taken(&self) -> usize
fn steps_taken(&self) -> usize
Total number of steps taken.
Source§fn completed_cycle(&self) -> bool
fn completed_cycle(&self) -> bool
Whether the scheduler has completed a cycle (if applicable).
Auto Trait Implementations§
impl Freeze for WarmupScheduler
impl !RefUnwindSafe for WarmupScheduler
impl Send for WarmupScheduler
impl !Sync for WarmupScheduler
impl Unpin for WarmupScheduler
impl UnsafeUnpin for WarmupScheduler
impl !UnwindSafe for WarmupScheduler
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