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

a.numpy()

改为

a.cpu().unmpy()

tensor的复制

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

猜你喜欢

转载自blog.csdn.net/ResumeProject/article/details/121643345
今日推荐