TypeError: can‘t convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor

TypeError: can’t convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor

  在报错的变量后面加

.cuda().data.cpu().numpy()

即可解决

你可能感兴趣的:(报错专栏,python,cpu,深度学习,人工智能)