常见错误 RuntimeError: expected type torch.FloatTensor but got torch.cuda.FloatTensor

https://www.jianshu.com/p/0be7a375bdbe

https://blog.csdn.net/qq_38410428/article/details/82973895

计算中有的参数为cuda型,有的参数却是cpu型,就会遇到这样的错误。

 

 

解决办法:

该加.cuda()的加上,不该用.cpu()的地方去掉它。

 

posted on   吱吱了了  阅读(4675)  评论(0编辑  收藏  举报

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

导航

统计

点击右上角即可分享
微信分享提示