pub struct GradStore(/* private fields */);
Expand description
A store for gradients, associating a tensor id to the corresponding gradient tensor, used for back propagation.
Implementations§
Source§impl GradStore
impl GradStore
Sourcepub fn get_id(&self, id: TensorId) -> Option<&Tensor>
pub fn get_id(&self, id: TensorId) -> Option<&Tensor>
Get the gradient tensor corresponding to the given tensor id
Sourcepub fn get(&self, tensor: &Tensor) -> Option<&Tensor>
pub fn get(&self, tensor: &Tensor) -> Option<&Tensor>
Get the gradient tensor associated with the given tensor
Sourcepub fn remove(&mut self, tensor: &Tensor) -> Option<Tensor>
pub fn remove(&mut self, tensor: &Tensor) -> Option<Tensor>
Remove the gradient tensor associated with the given tensor, returning it if it exists
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GradStore
impl !RefUnwindSafe for GradStore
impl Send for GradStore
impl Sync for GradStore
impl Unpin for GradStore
impl !UnwindSafe for GradStore
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