pub struct LinearWarmupLr { /* private fields */ }Expand description
Linear warmup learning-rate scheduler.
Computes:
lr = start_lr + (base_lr - start_lr) * min(epoch, warmup_steps)/warmup_steps.
Implementations§
Source§impl LinearWarmupLr
impl LinearWarmupLr
Sourcepub fn new(warmup_steps: usize) -> Result<Self, OptimError>
pub fn new(warmup_steps: usize) -> Result<Self, OptimError>
Creates warmup scheduler with warmup_steps > 0.
Sourcepub fn with_start_lr(self, start_lr: f32) -> Result<Self, OptimError>
pub fn with_start_lr(self, start_lr: f32) -> Result<Self, OptimError>
Sets explicit warmup start learning rate.
Sourcepub fn with_base_lr(self, base_lr: f32) -> Result<Self, OptimError>
pub fn with_base_lr(self, base_lr: f32) -> Result<Self, OptimError>
Sets explicit warmup end/base learning rate.
pub fn warmup_steps(&self) -> usize
pub fn start_lr(&self) -> Option<f32>
pub fn base_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 LinearWarmupLr
impl Clone for LinearWarmupLr
Source§fn clone(&self) -> LinearWarmupLr
fn clone(&self) -> LinearWarmupLr
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 LinearWarmupLr
impl Debug for LinearWarmupLr
Source§impl LrScheduler for LinearWarmupLr
impl LrScheduler for LinearWarmupLr
Source§impl PartialEq for LinearWarmupLr
impl PartialEq for LinearWarmupLr
impl StructuralPartialEq for LinearWarmupLr
Auto Trait Implementations§
impl Freeze for LinearWarmupLr
impl RefUnwindSafe for LinearWarmupLr
impl Send for LinearWarmupLr
impl Sync for LinearWarmupLr
impl Unpin for LinearWarmupLr
impl UnsafeUnpin for LinearWarmupLr
impl UnwindSafe for LinearWarmupLr
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