pub struct DistributedOptimizer<T: Float> { /* private fields */ }Expand description
Distributed optimizer wrapper
Implementations§
Source§impl<T: Float + ScalarOperand> DistributedOptimizer<T>
impl<T: Float + ScalarOperand> DistributedOptimizer<T>
Sourcepub fn new(backend: Arc<dyn SyncBackend<T>>, config: DistributedConfig) -> Self
pub fn new(backend: Arc<dyn SyncBackend<T>>, config: DistributedConfig) -> Self
Create a new distributed optimizer
Sourcepub fn accumulate_gradient(&self, gradients: Vec<NdArray<T>>) -> Result<()>
pub fn accumulate_gradient(&self, gradients: Vec<NdArray<T>>) -> Result<()>
Accumulate gradient
Sourcepub fn should_sync(&self) -> Result<bool>
pub fn should_sync(&self) -> Result<bool>
Check if ready to synchronize
Sourcepub fn sync_gradients(&self) -> Result<Vec<NdArray<T>>>
pub fn sync_gradients(&self) -> Result<Vec<NdArray<T>>>
Synchronize accumulated gradients
Sourcepub fn config(&self) -> &DistributedConfig
pub fn config(&self) -> &DistributedConfig
Get configuration
Auto Trait Implementations§
impl<T> Freeze for DistributedOptimizer<T>
impl<T> !RefUnwindSafe for DistributedOptimizer<T>
impl<T> Send for DistributedOptimizer<T>
impl<T> Sync for DistributedOptimizer<T>
impl<T> Unpin for DistributedOptimizer<T>
impl<T> UnsafeUnpin for DistributedOptimizer<T>
impl<T> !UnwindSafe for DistributedOptimizer<T>
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> 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