pub struct TensorLRScheduler { /* private fields */ }Expand description
Learning rate scheduler with multiple strategy support.
Implementations§
Source§impl TensorLRScheduler
impl TensorLRScheduler
Sourcepub fn new(config: LRSchedulerConfig) -> Self
pub fn new(config: LRSchedulerConfig) -> Self
Create a new scheduler from the given config. The initial learning rate is computed for step 0.
Sourcepub fn step(&mut self) -> f64
pub fn step(&mut self) -> f64
Advance by one step, compute the new learning rate, and return it.
Sourcepub fn get_lr(&self) -> f64
pub fn get_lr(&self) -> f64
Return the current learning rate without advancing the step counter.
Sourcepub fn set_step(&mut self, step: usize)
pub fn set_step(&mut self, step: usize)
Jump to a specific step and recompute the learning rate.
Sourcepub fn remaining_steps(&self) -> Option<usize>
pub fn remaining_steps(&self) -> Option<usize>
For finite schedules (Cosine, OneCycle, WarmupLinear) return the number
of remaining steps. Returns None for schedules that run indefinitely.
Sourcepub fn stats(&self) -> LRSchedulerStats
pub fn stats(&self) -> LRSchedulerStats
Return a snapshot of the scheduler state.
Sourcepub fn config(&self) -> &LRSchedulerConfig
pub fn config(&self) -> &LRSchedulerConfig
Read-only access to the config.
Trait Implementations§
Source§impl Clone for TensorLRScheduler
impl Clone for TensorLRScheduler
Source§fn clone(&self) -> TensorLRScheduler
fn clone(&self) -> TensorLRScheduler
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TensorLRScheduler
impl RefUnwindSafe for TensorLRScheduler
impl Send for TensorLRScheduler
impl Sync for TensorLRScheduler
impl Unpin for TensorLRScheduler
impl UnsafeUnpin for TensorLRScheduler
impl UnwindSafe for TensorLRScheduler
Blanket Implementations§
impl<T> Allocation for T
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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