看到一篇讲解detach()的文章还不错特此转载 文章地址:Pytorch torch.Tensor.detach()方法的用法及修改指定模块权重的方法_笨笨的蛋的博客-CSDN博客_tensor.detach