Canjie-Luo/MORAN_v2

RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

hwlll opened this issue · 2 comments

hwlll commented

请问我运行demo.py时产生错误:
File "/home/hwl/MORAN_v2-master/models/morn.py", line 113, in forward
img_offsets = (offsets_grid[i]).view(1, self.targetH, self.targetW).data.cpu().add_(-v_min).mul_(1./(v_max-v_min))
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
服务器包含cpu和gpu,但加载模型时都放在cuda上了,却仍然报这个错误,请问是什么问题呢

Facing the same issue @Canjie-Luo Please merge this to the main branch.

@Canjie-Luo I can confirm on my end that this approach is working. 👍