pub enum Decay {
None(f32),
Linear {
start: f32,
decay: f32,
},
Cosine {
start: f32,
end: f32,
num_steps: usize,
},
}Expand description
A value which can decay according to some schedule over the progression of timesteps.
Variants§
None(f32)
No decay: The specified constant is used regardless of timestep.
Linear
Linear decay: The value decays from start by decay each timestep.
Cosine
Cosine decay: The value smoothly decays from start to end over num_steps timesteps,
with the decay matching the shape of the cosine function.
Implementations§
Source§impl Decay
impl Decay
Sourcepub fn start_value(&self) -> f32
pub fn start_value(&self) -> f32
The output value at timestep 0.
Sourcepub fn at_timestep(&self, timestep: usize) -> f32
pub fn at_timestep(&self, timestep: usize) -> f32
The output value at the specified timestep.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Decay
impl<'de> Deserialize<'de> for Decay
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Decay
impl RefUnwindSafe for Decay
impl Send for Decay
impl Sync for Decay
impl Unpin for Decay
impl UnsafeUnpin for Decay
impl UnwindSafe for Decay
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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