评价此页

torch.Tensor.retain_grad#

Tensor.retain_grad() None#

启用此 Tensor 在 backward() 过程中填充其 grad。对于叶子张量,这是一个空操作。