pub enum Rate {
Fixed(f32),
Linear(f32, f32, usize),
Exponential(f32, f32, usize),
Cyclical(f32, f32, usize, CycleShape),
Stepwise(Vec<(usize, f32)>),
WarmupExp {
warmup_steps: usize,
start: f32,
peak: f32,
end: f32,
half_life: usize,
},
}Variants§
Fixed(f32)
Linear(f32, f32, usize)
A linear rate that changes from start to end over a number of steps.
§Parameters
start: The starting rate value.end: The ending rate value.steps: The number of steps over which to change the rate.
Exponential(f32, f32, usize)
An exponential rate that changes from start to end over a half-life period.
§Parameters
start: The starting rate value.end: The ending rate value.half_life: The half-life period over which to change the rate.
Cyclical(f32, f32, usize, CycleShape)
A cyclical rate that oscillates between min and max over a period.
§Parameters
min: The minimum rate value.max: The maximum rate value.period: The period over which to cycle the rate.shape: The shape of the cycle (Triangle or Sine).
Stepwise(Vec<(usize, f32)>)
Piecewise-constant schedule: at each listed step, rate jumps to the given value. The value remains constant until the next listed step. The first step must be 0. If the current step is beyond the last listed step, the rate remains at the last value.
§Parameters
Vec<(usize, f32)>: A vector of (step, rate) pairs.
WarmupExp
A warmup exponential schedule that starts at start, rises to peak over warmup_steps,
then decays to end with a half-life of half_life.
§Parameters
warmup_steps: Number of steps to reach peak from start.start: The starting rate value.peak: The peak rate value after warmup.end: The ending rate value after decay.half_life: The half-life period for decay after warmup.
Implementations§
Trait Implementations§
impl StructuralPartialEq for Rate
Auto Trait Implementations§
impl Freeze for Rate
impl RefUnwindSafe for Rate
impl Send for Rate
impl Sync for Rate
impl Unpin for Rate
impl UnwindSafe for Rate
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