pub struct GradientSynchronizer { /* private fields */ }Expand description
Gradient synchronizer.
Implementations§
Source§impl GradientSynchronizer
impl GradientSynchronizer
Sourcepub fn new(strategy: GradSyncStrategy, bucket_size: usize) -> Self
pub fn new(strategy: GradSyncStrategy, bucket_size: usize) -> Self
Creates a new gradient synchronizer.
Sourcepub fn strategy(&self) -> GradSyncStrategy
pub fn strategy(&self) -> GradSyncStrategy
Returns the synchronization strategy.
Sourcepub fn add_gradient(&mut self, bucket_idx: usize, tensor: &Tensor<f32>)
pub fn add_gradient(&mut self, bucket_idx: usize, tensor: &Tensor<f32>)
Adds a gradient to the appropriate bucket.
Sourcepub fn sync_all(&mut self, process_group: &ProcessGroup)
pub fn sync_all(&mut self, process_group: &ProcessGroup)
Synchronizes all buckets.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GradientSynchronizer
impl RefUnwindSafe for GradientSynchronizer
impl Send for GradientSynchronizer
impl Sync for GradientSynchronizer
impl Unpin for GradientSynchronizer
impl UnwindSafe for GradientSynchronizer
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