torch.Tensor.retain_grad¶ Tensor.retain_grad() → None¶ 使此 Tensor 能够在 backward() 期间填充其 grad 属性。对于叶子 Tensor,此操作无效。