首页 > 其他 > 详细

RuntimeError: Expected object of type torch.cuda.FloatTensor but found type torch.FloatTensor for ar

时间:2020-04-02 00:01:07      阅读:84      评论:0      收藏:0      [点我收藏+]

这行报错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

RuntimeError: Expected object of type torch.cuda.FloatTensor but found type torch.FloatTensor for ar

原文:https://www.cnblogs.com/wind-chaser/p/12616865.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!