torch.Tensor.retains_grad

Tensor.retain_grad

如果此张量是非叶子张量,并且其grad在调用backward()期间被启用以进行填充,则为True,否则为False