torch.Tensor.retain_grad¶
-
Tensor.
retain_grad
() → None¶ Enables this Tensor to have their
grad
populated duringbackward()
. This is a no-op for leaf tensors.
Tensor.
retain_grad
() → None¶Enables this Tensor to have their grad
populated during
backward()
. This is a no-op for leaf tensors.