指向
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”)

指向
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”)