pub struct MultiGradientsParams {
pub grads: Vec<(GradientsParams, DeviceId)>,
}Expand description
Exposes multiple gradients for each parameter.
Fields§
§grads: Vec<(GradientsParams, DeviceId)>Each GradientsParams has its associated DeviceId.
Implementations§
Source§impl MultiGradientsParams
impl MultiGradientsParams
Sourcepub fn remove<B: Backend, const D: usize>(
&mut self,
id: ParamId,
) -> Option<(Tensor<B, D>, Device<B>)>
pub fn remove<B: Backend, const D: usize>( &mut self, id: ParamId, ) -> Option<(Tensor<B, D>, Device<B>)>
Removes the gradients for the given parameter id.
Potentially accumulates the gradients from multiple sources using a device associated with a parameter id. The same parameter will be accumulated using the same device during all training.
Trait Implementations§
Source§impl Default for MultiGradientsParams
impl Default for MultiGradientsParams
Source§fn default() -> MultiGradientsParams
fn default() -> MultiGradientsParams
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MultiGradientsParams
impl !RefUnwindSafe for MultiGradientsParams
impl Send for MultiGradientsParams
impl !Sync for MultiGradientsParams
impl Unpin for MultiGradientsParams
impl !UnwindSafe for MultiGradientsParams
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