pub struct OneCycleLr { /* private fields */ }Expand description
One-cycle learning-rate scheduler with linear warmup and linear cooldown.
Implementations§
Source§impl OneCycleLr
impl OneCycleLr
Sourcepub fn new(total_steps: usize, max_lr: f32) -> Result<Self, OptimError>
pub fn new(total_steps: usize, max_lr: f32) -> Result<Self, OptimError>
Creates one-cycle scheduler.
total_steps > 0max_lr >= 0
Sourcepub fn with_pct_start(self, pct_start: f32) -> Result<Self, OptimError>
pub fn with_pct_start(self, pct_start: f32) -> Result<Self, OptimError>
Sets fraction of cycle spent in the up phase.
Sourcepub fn with_final_div_factor(
self,
final_div_factor: f32,
) -> Result<Self, OptimError>
pub fn with_final_div_factor( self, final_div_factor: f32, ) -> Result<Self, OptimError>
Sets divisor used for final LR (final_lr = initial_lr / final_div_factor).
Sourcepub fn with_initial_lr(self, initial_lr: f32) -> Result<Self, OptimError>
pub fn with_initial_lr(self, initial_lr: f32) -> Result<Self, OptimError>
Pins explicit initial LR used by the schedule.
pub fn total_steps(&self) -> usize
pub fn max_lr(&self) -> f32
pub fn pct_start(&self) -> f32
pub fn final_div_factor(&self) -> f32
pub fn initial_lr(&self) -> Option<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 OneCycleLr
impl Clone for OneCycleLr
Source§fn clone(&self) -> OneCycleLr
fn clone(&self) -> OneCycleLr
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 OneCycleLr
impl Debug for OneCycleLr
Source§impl LrScheduler for OneCycleLr
impl LrScheduler for OneCycleLr
Source§impl PartialEq for OneCycleLr
impl PartialEq for OneCycleLr
impl StructuralPartialEq for OneCycleLr
Auto Trait Implementations§
impl Freeze for OneCycleLr
impl RefUnwindSafe for OneCycleLr
impl Send for OneCycleLr
impl Sync for OneCycleLr
impl Unpin for OneCycleLr
impl UnsafeUnpin for OneCycleLr
impl UnwindSafe for OneCycleLr
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