pub struct ParamState {
pub momentum_buffer: Option<Vec<f32>>,
pub exp_avg_sq: Option<Vec<f32>>,
pub max_exp_avg_sq: Option<Vec<f32>>,
pub step: usize,
}Expand description
State associated with a parameter during optimization.
Different optimizers store different state (e.g., momentum, variance).
Fields§
§momentum_buffer: Option<Vec<f32>>First moment (momentum) - used by SGD with momentum, Adam
exp_avg_sq: Option<Vec<f32>>Second moment (variance) - used by Adam, RMSprop
max_exp_avg_sq: Option<Vec<f32>>Max second moment - used by AdaMax
step: usizeStep count for bias correction
Implementations§
Source§impl ParamState
impl ParamState
Sourcepub fn init_momentum(&mut self, size: usize)
pub fn init_momentum(&mut self, size: usize)
Initializes momentum buffer with zeros.
Sourcepub fn init_exp_avg_sq(&mut self, size: usize)
pub fn init_exp_avg_sq(&mut self, size: usize)
Initializes exponential average squared buffer with zeros.
Trait Implementations§
Source§impl Clone for ParamState
impl Clone for ParamState
Source§fn clone(&self) -> ParamState
fn clone(&self) -> ParamState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ParamState
impl Debug for ParamState
Auto Trait Implementations§
impl Freeze for ParamState
impl RefUnwindSafe for ParamState
impl Send for ParamState
impl Sync for ParamState
impl Unpin for ParamState
impl UnwindSafe for ParamState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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