It seems that in your cpu code you use Variable(), but you don’t use it in your gpu code. This might be the source of the problem.
Which version of PyTorch do you use ? Variable() is deprecated since v0.4