pub struct SparseUpdateOptimizer<T> { /* private fields */ }Expand description
Wrapper optimizer that adds sparse update functionality
Implementations§
Source§impl<T> SparseUpdateOptimizer<T>where
T: SparseUpdateSupport,
impl<T> SparseUpdateOptimizer<T>where
T: SparseUpdateSupport,
Sourcepub fn new(inner: T, config: SparseUpdateConfig) -> Self
pub fn new(inner: T, config: SparseUpdateConfig) -> Self
Create a new sparse update optimizer wrapper
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enable or disable sparse updates
Sourcepub fn sparse_manager(&self) -> &SparseUpdateManager
pub fn sparse_manager(&self) -> &SparseUpdateManager
Get the sparse manager
Sourcepub fn submit_gradients(
&mut self,
gradients: HashMap<String, Vec<f32>>,
) -> Result<(), OptimizerError>
pub fn submit_gradients( &mut self, gradients: HashMap<String, Vec<f32>>, ) -> Result<(), OptimizerError>
Submit gradients for sparse processing
Sourcepub fn get_parameter_statistics(
&self,
parameter_id: &str,
) -> Option<SparsePatternStatistics>
pub fn get_parameter_statistics( &self, parameter_id: &str, ) -> Option<SparsePatternStatistics>
Get statistics for a specific parameter
Sourcepub fn get_statistics(&self) -> OverallSparseStatistics
pub fn get_statistics(&self) -> OverallSparseStatistics
Get overall statistics
Auto Trait Implementations§
impl<T> Freeze for SparseUpdateOptimizer<T>where
T: Freeze,
impl<T> RefUnwindSafe for SparseUpdateOptimizer<T>where
T: RefUnwindSafe,
impl<T> Send for SparseUpdateOptimizer<T>where
T: Send,
impl<T> Sync for SparseUpdateOptimizer<T>where
T: Sync,
impl<T> Unpin for SparseUpdateOptimizer<T>where
T: Unpin,
impl<T> UnsafeUnpin for SparseUpdateOptimizer<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for SparseUpdateOptimizer<T>where
T: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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