Hi everyone. Whenever I instantiate a Variable() and call cuda() on it I seem to be unable to create an optimizer that optimizes over it:
x = Variable(torch.FloatTensor(some_np_array), requires_grad=True)
x = x.cuda()
optimizer = optim.SGD([x], lr=1e-2)

throws the exception
ValueError: can't optimize a non-leaf Variable

whereas not calling .cuda() works fine. What is the correct way to optimize over variables that can be processed on the GPU?