CPU跑的好好的,迁移到GPU后,BUG一个接着一个
Expected object of device type cuda but got device type cpu for argument
Expected object of backend CUDA but got backend CPU for sequence element 0 in sequence argument at position #1 ‘tensors’
以上都是输入数据或者变量的问题,仔细检查代码、padding时的变量是否迁移等,查不出可以debug,就是慢…
除了这些 https://www.jb51.net/article/213830.htm
还有模型新建的内部张量(模型迁移了,内部张量就会迁移)
但是我自己改了模型,遇到数据类型不匹配的问题
Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same
排查后发现是构建模型时用到字典dict 不会自动迁移到GPU
以前的写法:
self.d_tempconv = {
}
for window_size in self.window