指向
s_map_norm = torch.mul(s_map_norm , gt)
查看s_map_norm与gt是否在cuda上,用:
print(s_map_norm.is_cuda, gt.is_cuda)
输出
True False
则说明gt不在cuda上
用
gt = gt.to(device)
即可
注:device = torch.device(“cuda:0” if torch.cuda.is_available() else “cpu”)
Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu
最新推荐文章于 2024-02-28 23:46:39 发布