RuntimeError: Expected object of device type cuda but got device type cpu for argument #2 'mat2' in call to _th_mm
gate = gc(img,img_org,cap)
应该是说我这个地方启用了CPU没有放到GPU里,查了一些方法,mark一下
- 我这里gc()是一个def,试着把gc()写成nn.Model的类函数(失败)
- 试着把gc()移到class model()里,失败
-
最后,成功,我真的是太小白了
before:
self.linear = nn.Linear(output1.size()[0], 1)
now:
self.linear = nn.Linear(output1.size()[0], 1).cuda()