pub struct MultiStepLr { /* private fields */ }Expand description
Multi-step learning-rate scheduler.
Drops the learning rate by gamma at each milestone epoch in milestones.
Implementations§
Source§impl MultiStepLr
impl MultiStepLr
Sourcepub fn new(milestones: Vec<usize>, gamma: f32) -> Result<Self, OptimError>
pub fn new(milestones: Vec<usize>, gamma: f32) -> Result<Self, OptimError>
Creates multi-step scheduler with sorted milestones and gamma in (0, 1].
pub fn milestones(&self) -> &[usize]
pub fn gamma(&self) -> f32
pub fn epoch(&self) -> usize
pub fn reset(&mut self)
pub fn step<O: LearningRate>( &mut self, optimizer: &mut O, ) -> Result<f32, OptimError>
Trait Implementations§
Source§impl Clone for MultiStepLr
impl Clone for MultiStepLr
Source§fn clone(&self) -> MultiStepLr
fn clone(&self) -> MultiStepLr
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 MultiStepLr
impl Debug for MultiStepLr
Source§impl LrScheduler for MultiStepLr
impl LrScheduler for MultiStepLr
Source§impl PartialEq for MultiStepLr
impl PartialEq for MultiStepLr
impl StructuralPartialEq for MultiStepLr
Auto Trait Implementations§
impl Freeze for MultiStepLr
impl RefUnwindSafe for MultiStepLr
impl Send for MultiStepLr
impl Sync for MultiStepLr
impl Unpin for MultiStepLr
impl UnsafeUnpin for MultiStepLr
impl UnwindSafe for MultiStepLr
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