![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
调试报错
我没有GPU
这个作者很懒,什么都没留下…
展开
-
Expected object of backend CPU but got backend CUDA for argument #2 ‘weight‘
意思是说:需要一个 CUDA tensor, 你给的却是个 CPU tensor解决:变量后面.cuda()Variable(adv_img_tea).cuda()原创 2021-12-06 22:33:52 · 224 阅读 · 0 评论 -
pytorch RuntimeError: size mismatch, m1: [64 x 784], m2: [784 x 10] at
原文链接:https://blog.csdn.net/qq_35674954/article/details/106943907from torch import nnclass Mnist_Logistic(nn.Module): def __init__(self): super().__init__() self.lin=nn.Linear(748,10) def forward(self,xb): return self转载 2021-12-04 21:40:42 · 1834 阅读 · 0 评论 -
报错:RuntimeError: Expected object of backend CUDA but got backend CPU for argument #3 ‘index‘
原文链接:https://www.codeleading.com/article/99873329129/RuntimeError: Expected object of backend CUDA but got backend CPU for argument #3 'index'分析:data数据或者model没有调用.to(device)解决: # 进行可用设备检测, 有GPU的话将优先使用GPU device = torch.device("cuda" if torch.cud转载 2021-12-01 11:00:49 · 1138 阅读 · 0 评论