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

阅读 77

2022-04-15

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)

0 0 举报