a = Variable(torch.ones(2)
if torch.cuda.is_available():
a.cuda()
However, this is not working for some reason. a
is still a Variable
of torch.FloatTensor
. Any workaround?
a = Variable(torch.ones(2)
if torch.cuda.is_available():
a.cuda()
However, this is not working for some reason. a
is still a Variable
of torch.FloatTensor
. Any workaround?
The tensor.cuda()
method returns a new tensor. Try a = a.cuda()
.