如何检查张量是否在Pytorch中的cuda上?
我有张量
t = torch.zeros((4, 5, 6))
如何检查它是否在gpu上?
回答
来自 pytorch 论坛
用 t.is_cuda
t = torch.randn(2,2)
t.is_cuda # returns False
t = torch.randn(2,2).cuda()
t.is_cuda # returns True
我有张量
t = torch.zeros((4, 5, 6))
如何检查它是否在gpu上?
来自 pytorch 论坛
用 t.is_cuda
t = torch.randn(2,2)
t.is_cuda # returns False
t = torch.randn(2,2).cuda()
t.is_cuda # returns True