一.问题描述
在用GPU训练模型时报如下的错误:
TypeError: can’t convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
.解决方案:
方法非常简单,只需把numpy 1.21降为numpy1.19就好了,亲测有用。
pip install numpy==1.19
一.问题描述
在用GPU训练模型时报如下的错误:
TypeError: can’t convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
.解决方案:
方法非常简单,只需把numpy 1.21降为numpy1.19就好了,亲测有用。
pip install numpy==1.19