pub struct SparseSGD { /* private fields */ }Expand description
Sparse SGD with momentum optimizer.
Implementations§
Source§impl SparseSGD
impl SparseSGD
pub fn new( learning_rate: f32, momentum: f32, dampening: f32, weight_decay: f32, nesterov: bool, config: SparseConfig, ) -> Self
Sourcepub fn with_default_config(
learning_rate: f32,
momentum: f32,
dampening: f32,
weight_decay: f32,
nesterov: bool,
) -> Self
pub fn with_default_config( learning_rate: f32, momentum: f32, dampening: f32, weight_decay: f32, nesterov: bool, ) -> Self
Create with default sparse configuration.
Sourcepub fn get_momentum_stats(&self) -> HashMap<usize, usize>
pub fn get_momentum_stats(&self) -> HashMap<usize, usize>
Get momentum statistics.
Sourcepub fn total_active_states(&self) -> usize
pub fn total_active_states(&self) -> usize
Total number of active momentum states across all parameters.
Sourcepub fn cleanup_momentum_states(&mut self)
pub fn cleanup_momentum_states(&mut self)
Cleanup old momentum states for all parameters.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SparseSGD
impl RefUnwindSafe for SparseSGD
impl Send for SparseSGD
impl Sync for SparseSGD
impl Unpin for SparseSGD
impl UnwindSafe for SparseSGD
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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