报错:RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda

详细的报错信息如下:

RuntimeError: Expected all tensors to be on the same device, 
but found at least two devices, cuda:0 and cpu! 
(when checking argument for argument mat1 in method wrapper_mm)

报错位置

报错的位置是:网络的forward函数(linear.py/forward)
在这里插入图片描述

解决办法

在这里插入图片描述

你可能感兴趣的:(pytorch,pytorch)