这行报错predict = model(Variable(x_train))
RuntimeError: Expected object of type torch.cuda.FloatTensor but found type torch.FloatTensor for argument #4 'mat1'
意思是要求的目标类型是torch.cuda.FloatTensor,但是找到的数据类型是torch.FloatTensor,所以需要在数据类型后面加上.cuda()。将predict = model(Variable(x_train)) 改为predict = model(Variable(x_train.cuda()))
————————————————
ref:https://blog.csdn.net/qq_38410428/article/details/82973895