pub struct StepDecayScheduler { /* private fields */ }Expand description
Multiplies the learning rate by gamma every step_size steps.
lr_t = base_lr * gamma^floor(t / step_size)
Implementations§
Source§impl StepDecayScheduler
impl StepDecayScheduler
Sourcepub fn new(
base_lr: f64,
gamma: f64,
step_size: usize,
) -> Result<Self, SchedulerError>
pub fn new( base_lr: f64, gamma: f64, step_size: usize, ) -> Result<Self, SchedulerError>
Create a new step decay scheduler.
§Errors
Returns SchedulerError::InvalidConfig if any parameter is invalid.
Trait Implementations§
Source§impl LrSchedulerV2 for StepDecayScheduler
impl LrSchedulerV2 for StepDecayScheduler
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 StepDecayScheduler
impl RefUnwindSafe for StepDecayScheduler
impl Send for StepDecayScheduler
impl Sync for StepDecayScheduler
impl Unpin for StepDecayScheduler
impl UnsafeUnpin for StepDecayScheduler
impl UnwindSafe for StepDecayScheduler
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