pub trait LrScheduler {
// Required methods
fn step(&mut self, optimizer: &mut dyn Optimizer);
fn get_lr(&self) -> f64;
fn state_dict(&self) -> HashMap<String, f64>;
fn load_state_dict(
&mut self,
state: &HashMap<String, f64>,
) -> TrainResult<()>;
}Expand description
Trait for learning rate schedulers.
Required Methods§
Sourcefn step(&mut self, optimizer: &mut dyn Optimizer)
fn step(&mut self, optimizer: &mut dyn Optimizer)
Update learning rate based on current step/epoch.
Sourcefn state_dict(&self) -> HashMap<String, f64>
fn state_dict(&self) -> HashMap<String, f64>
Get scheduler state as a dictionary.
Sourcefn load_state_dict(&mut self, state: &HashMap<String, f64>) -> TrainResult<()>
fn load_state_dict(&mut self, state: &HashMap<String, f64>) -> TrainResult<()>
Load scheduler state from a dictionary.