pub trait ApplyGradientExt<Delta, T>: ApplyGradient<Delta, T> {
type Velocity;
// Required methods
fn apply_gradient_with_momentum(
&mut self,
grad: &Delta,
lr: T,
momentum: T,
velocity: &mut Self::Velocity,
) -> Option<Self::Output>;
fn apply_gradient_with_decay_and_momentum(
&mut self,
grad: &Delta,
lr: T,
decay: T,
momentum: T,
velocity: &mut Self::Velocity,
) -> Option<Self::Output>;
}Expand description
This trait extends the ApplyGradient trait by allowing for momentum-based optimization
Required Associated Types§
Required Methods§
fn apply_gradient_with_momentum( &mut self, grad: &Delta, lr: T, momentum: T, velocity: &mut Self::Velocity, ) -> Option<Self::Output>
fn apply_gradient_with_decay_and_momentum( &mut self, grad: &Delta, lr: T, decay: T, momentum: T, velocity: &mut Self::Velocity, ) -> Option<Self::Output>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".