0
点赞
收藏
分享

微信扫一扫

【笔记】plt.plot 打印列表报错:列表元素应该是使用cpu设备并且不参与梯度计算才可以转化为numpy进行绘图

醉倾城1 2022-04-15 阅读 77
python

1. 列表元素是gpu时报错:

TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

2.列表元素是cpu时仍然报错:

RuntimeError: Can't call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead.

举报
0 条评论