Hi,
The problem is that when you do x = x.cuda(), the new x is not the same as the old one.
If you do x_cuda = x.cuda(), then you can give x to the optimizer.
It is even better to send it to cuda before creating the Variable:
x = Variable(torch.FloatTensor(some_np_array).cuda(), requires_grad=True)