【BUG解决】 RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor)
生活随笔
收集整理的這篇文章主要介紹了
【BUG解决】 RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
問題描述
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type
(torch.FloatTensor) should be the same
解決方法
對net或者新添加的模塊進行轉換。
解決方法1
device = torch.device('cuda:0') net= net.to(device)解決方法2
net = net.cuda()總結
以上是生活随笔為你收集整理的【BUG解决】 RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: JavaAndroid 基础知识梳理(8
- 下一篇: Dynamics 365 V9 on-p