pub struct LearningSchedule<T: Float + Debug + ScalarOperand + Send + Sync + 'static> {
pub initial_rate: T,
pub current_rate: T,
pub warmup_steps: usize,
pub decay_factor: T,
/* private fields */
}Expand description
Linear-warmup-then-exponential-decay learning-rate schedule.
initial_rate, warmup_steps and decay_factor used to be stored and never
consulted: the schedule had no way to advance, so current_rate stayed at
initial_rate forever and LearningState held a schedule it never used.
Fields§
§initial_rate: T§current_rate: T§warmup_steps: usize§decay_factor: TImplementations§
Source§impl<T: Float + Debug + ScalarOperand + Send + Sync + 'static> LearningSchedule<T>
impl<T: Float + Debug + ScalarOperand + Send + Sync + 'static> LearningSchedule<T>
pub fn new(initial_rate: T, warmup_steps: usize) -> Self
Sourcepub fn rate_at(&self, step: usize) -> T
pub fn rate_at(&self, step: usize) -> T
Rate at step: initial_rate · step / warmup_steps while warming up,
then initial_rate · decay_factor^(step - warmup_steps).
With warmup_steps == 0 the warmup phase is skipped entirely.
Sourcepub fn steps_taken(&self) -> usize
pub fn steps_taken(&self) -> usize
Steps taken so far.
Trait Implementations§
Source§impl<T: Clone + Float + Debug + ScalarOperand + Send + Sync + 'static> Clone for LearningSchedule<T>
impl<T: Clone + Float + Debug + ScalarOperand + Send + Sync + 'static> Clone for LearningSchedule<T>
Auto Trait Implementations§
impl<T> Freeze for LearningSchedule<T>where
T: Freeze,
impl<T> RefUnwindSafe for LearningSchedule<T>where
T: RefUnwindSafe,
impl<T> Send for LearningSchedule<T>
impl<T> Sync for LearningSchedule<T>
impl<T> Unpin for LearningSchedule<T>where
T: Unpin,
impl<T> UnsafeUnpin for LearningSchedule<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for LearningSchedule<T>where
T: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.