pub struct RMSprop { /* private fields */ }Expand description
RMSprop optimizer (Hinton, 2012).
Maintains a running average of squared gradients to normalize the update. Optionally supports momentum and weight decay.
Update rule (without momentum): v = alpha * v + (1 - alpha) * grad^2 param -= lr * grad / (sqrt(v) + eps)
With momentum: v = alpha * v + (1 - alpha) * grad^2 buf = momentum * buf + grad / (sqrt(v) + eps) param -= lr * buf
ⓘ
let mut optim = RMSprop::new(&model.parameters(), 0.01);
// Or with options:
let mut optim = RMSprop::builder(&model.parameters(), 0.01)
.alpha(0.99)
.momentum(0.9)
.weight_decay(1e-4)
.build();Implementations§
Source§impl RMSprop
impl RMSprop
Trait Implementations§
Source§impl Optimizer for RMSprop
impl Optimizer for RMSprop
Source§impl Stateful for RMSprop
impl Stateful for RMSprop
Source§fn save_state<W: Write>(&self, w: &mut W) -> Result<()>
fn save_state<W: Write>(&self, w: &mut W) -> Result<()>
Serialize optimizer state (lr, momentum buffers, etc.) to a writer.
Source§fn load_state<R: Read>(&mut self, r: &mut R) -> Result<()>
fn load_state<R: Read>(&mut self, r: &mut R) -> Result<()>
Restore optimizer state from a reader.
Auto Trait Implementations§
impl Freeze for RMSprop
impl !RefUnwindSafe for RMSprop
impl !Send for RMSprop
impl !Sync for RMSprop
impl Unpin for RMSprop
impl UnsafeUnpin 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