pub struct RmsProp { /* private fields */ }Expand description
RMSProp optimizer with optional momentum, weight decay, and centered variance.
Implementations§
Source§impl RmsProp
impl RmsProp
Sourcepub fn new(lr: f32) -> Result<Self, OptimError>
pub fn new(lr: f32) -> Result<Self, OptimError>
Creates RMSProp with required learning rate.
Sourcepub fn with_alpha(self, alpha: f32) -> Result<Self, OptimError>
pub fn with_alpha(self, alpha: f32) -> Result<Self, OptimError>
Sets RMSProp smoothing factor in [0, 1).
Sourcepub fn with_epsilon(self, epsilon: f32) -> Result<Self, OptimError>
pub fn with_epsilon(self, epsilon: f32) -> Result<Self, OptimError>
Sets epsilon value, must be finite and > 0.
Sourcepub fn with_weight_decay(self, weight_decay: f32) -> Result<Self, OptimError>
pub fn with_weight_decay(self, weight_decay: f32) -> Result<Self, OptimError>
Sets L2 weight decay factor in [0, +inf).
Sourcepub fn with_momentum(self, momentum: f32) -> Result<Self, OptimError>
pub fn with_momentum(self, momentum: f32) -> Result<Self, OptimError>
Sets momentum factor in [0, 1).
Sourcepub fn with_centered(self, centered: bool) -> Self
pub fn with_centered(self, centered: bool) -> Self
Enables/disables centered RMSProp variant.
Sourcepub fn clear_state(&mut self)
pub fn clear_state(&mut self)
Drops optimizer state (for example when restarting training).
Sourcepub fn learning_rate(&self) -> f32
pub fn learning_rate(&self) -> f32
Returns current learning rate.
Sourcepub fn set_learning_rate(&mut self, lr: f32) -> Result<(), OptimError>
pub fn set_learning_rate(&mut self, lr: f32) -> Result<(), OptimError>
Overrides current learning rate.
Sourcepub fn step(
&mut self,
parameter_id: u64,
weights: &mut Tensor,
grad: &Tensor,
) -> Result<(), OptimError>
pub fn step( &mut self, parameter_id: u64, weights: &mut Tensor, grad: &Tensor, ) -> Result<(), OptimError>
Applies one update to raw tensor weights.
Sourcepub fn step_graph_node(
&mut self,
graph: &mut Graph,
node: NodeId,
) -> Result<(), OptimError>
pub fn step_graph_node( &mut self, graph: &mut Graph, node: NodeId, ) -> Result<(), OptimError>
Applies one update to a trainable graph node by its NodeId.
Trait Implementations§
Source§impl LearningRate for RmsProp
impl LearningRate for RmsProp
Source§fn learning_rate(&self) -> f32
fn learning_rate(&self) -> f32
Returns current optimizer learning rate.
Source§fn set_learning_rate(&mut self, lr: f32) -> Result<(), OptimError>
fn set_learning_rate(&mut self, lr: f32) -> Result<(), OptimError>
Sets optimizer learning rate after validation.
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
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