style: apply rustfmt across all crates and demos
Consistent formatting pass: line wrapping, import sorting, trailing whitespace removal, let-chain indentation, merged derive attributes, and unsafe block reformatting. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
@@ -173,55 +173,55 @@ impl OneCycleScheduler {
|
||||
}
|
||||
|
||||
/// Get the maximum learning rate
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn max_lr(&self) -> f64 {
|
||||
self.max_lr
|
||||
}
|
||||
|
||||
/// Get the total number of steps
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn total_steps(&self) -> usize {
|
||||
self.total_steps
|
||||
}
|
||||
|
||||
/// Get the percentage of cycle for warm-up
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn pct_start(&self) -> f64 {
|
||||
self.pct_start
|
||||
}
|
||||
|
||||
/// Get the percentage of cycle for final decrease
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn final_div_factor_pct(&self) -> f64 {
|
||||
self.final_div_factor_pct
|
||||
}
|
||||
|
||||
/// Get the final learning rate divisor
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn final_div_factor(&self) -> f64 {
|
||||
self.final_div_factor
|
||||
}
|
||||
|
||||
/// Check if using momentum scheduling
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn use_momentum(&self) -> bool {
|
||||
self.use_momentum
|
||||
}
|
||||
|
||||
/// Get the base momentum (if momentum scheduling is enabled)
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn base_momentum(&self) -> Option<f64> {
|
||||
self.base_momentum
|
||||
}
|
||||
|
||||
/// Get the maximum momentum (if momentum scheduling is enabled)
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn max_momentum(&self) -> Option<f64> {
|
||||
self.max_momentum
|
||||
}
|
||||
|
||||
/// Get the current phase (0: warm-up, 1: cool-down, 2: annihilation)
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn get_phase(&self, step: usize) -> usize {
|
||||
let warmup_steps = (self.pct_start * self.total_steps as f64) as usize;
|
||||
let cooldown_end_steps =
|
||||
@@ -237,7 +237,7 @@ impl OneCycleScheduler {
|
||||
}
|
||||
|
||||
/// Get the progress within the current phase (0.0 to 1.0)
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn phase_progress(&self, step: usize) -> f64 {
|
||||
let warmup_steps = (self.pct_start * self.total_steps as f64) as usize;
|
||||
let cooldown_end_steps =
|
||||
@@ -275,7 +275,7 @@ impl OneCycleScheduler {
|
||||
}
|
||||
|
||||
/// Get the momentum value for the given step (if momentum scheduling is enabled)
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn get_momentum(&self, step: usize) -> Option<f64> {
|
||||
if !self.use_momentum {
|
||||
return None;
|
||||
|
||||
Reference in New Issue
Block a user