pub struct RAdam { /* private fields */ }Expand description
RAdam (Rectified Adam) optimizer with variance rectification.
Implementations§
Source§impl RAdam
impl RAdam
Sourcepub fn new(lr: f32) -> Result<Self, OptimError>
pub fn new(lr: f32) -> Result<Self, OptimError>
Creates RAdam with required learning rate.
Sourcepub fn with_beta1(self, beta1: f32) -> Result<Self, OptimError>
pub fn with_beta1(self, beta1: f32) -> Result<Self, OptimError>
Sets beta1 factor in [0, 1).
Sourcepub fn with_beta2(self, beta2: f32) -> Result<Self, OptimError>
pub fn with_beta2(self, beta2: f32) -> Result<Self, OptimError>
Sets beta2 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 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 RAdam
impl LearningRate for RAdam
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 RAdam
impl RefUnwindSafe for RAdam
impl Send for RAdam
impl Sync for RAdam
impl Unpin for RAdam
impl UnsafeUnpin for RAdam
impl UnwindSafe for RAdam
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