pub struct RMSprop { /* private fields */ }Expand description
RMSprop optimizer.
Maintains a moving average of squared gradients to normalize updates.
Update rule:
v_t = alpha * v_{t-1} + (1 - alpha) * grad^2
param = param - lr * grad / (sqrt(v_t) + eps)With momentum:
v_t = alpha * v_{t-1} + (1 - alpha) * grad^2
buf_t = momentum * buf_{t-1} + grad / (sqrt(v_t) + eps)
param = param - lr * buf_tImplementations§
Source§impl RMSprop
impl RMSprop
Sourcepub fn new(params: Vec<Parameter>, lr: f32) -> Self
pub fn new(params: Vec<Parameter>, lr: f32) -> Self
Creates a new RMSprop optimizer with default settings.
Sourcepub fn with_alpha(params: Vec<Parameter>, lr: f32, alpha: f32) -> Self
pub fn with_alpha(params: Vec<Parameter>, lr: f32, alpha: f32) -> Self
Creates RMSprop with specified alpha (smoothing constant).
Sourcepub fn with_options(
params: Vec<Parameter>,
lr: f32,
alpha: f32,
eps: f32,
weight_decay: f32,
momentum: f32,
centered: bool,
) -> Self
pub fn with_options( params: Vec<Parameter>, lr: f32, alpha: f32, eps: f32, weight_decay: f32, momentum: f32, centered: bool, ) -> Self
Creates RMSprop with all options.
Sourcepub fn weight_decay(self, weight_decay: f32) -> Self
pub fn weight_decay(self, weight_decay: f32) -> Self
Builder method to set weight decay.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RMSprop
impl !RefUnwindSafe for RMSprop
impl Send for RMSprop
impl Sync for RMSprop
impl Unpin for RMSprop
impl !UnwindSafe for RMSprop
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> 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