oneflow.Tensor.retain_grad

Tensor.retain_grad()

Enables this Tensor to have their grad populated during backward(). This is a no-op for leaf tensors.

Compatible with PyTorch.