tensor转换numpy失败 报错原因解决 报错原因 RuntimeError: Can’t call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead. 出现问题的地方: 解决 使用Tensor.detach().numpy() Tensor.detach().numpy() 由于是跑开源代码遇到的问题,作者写的也不好看,只好直接改tensor。不推荐这么做,但是作者传参不注意,也没得办法了。