torch.Tensor.requires_grad_¶
torch.Tensor.requires_grad_¶
torch.Tensor.requires_grad_(requires_grad=True)
paddle.Tensor.stop_gradient¶
paddle.Tensor.stop_gradient = False
两者功能一致,torch 为 funtion 调用方式,paddle 为 attribution 赋值方式,具体如下:
参数差异¶
| PyTorch | PaddlePaddle | 备注 | | ————- | ———— | —————————————————— | | requires_grad | - | 是否计算梯度 |