pub struct StepLr { /* private fields */ }Expand description
Piecewise constant learning-rate scheduler.
Every step_size calls to StepLr::step, the optimizer learning rate is
multiplied by gamma.
Implementations§
Source§impl StepLr
impl StepLr
Sourcepub fn new(step_size: usize, gamma: f32) -> Result<Self, OptimError>
pub fn new(step_size: usize, gamma: f32) -> Result<Self, OptimError>
Creates step scheduler with required step_size > 0 and gamma in (0, 1].
Sourcepub fn step<O: LearningRate>(
&mut self,
optimizer: &mut O,
) -> Result<f32, OptimError>
pub fn step<O: LearningRate>( &mut self, optimizer: &mut O, ) -> Result<f32, OptimError>
Advances scheduler by one epoch and returns resulting optimizer LR.
Trait Implementations§
Source§impl LrScheduler for StepLr
impl LrScheduler for StepLr
impl StructuralPartialEq for StepLr
Auto Trait Implementations§
impl Freeze for StepLr
impl RefUnwindSafe for StepLr
impl Send for StepLr
impl Sync for StepLr
impl Unpin for StepLr
impl UnsafeUnpin for StepLr
impl UnwindSafe for StepLr
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