How are you specifying the GPU ids?
In your current code snippet you are using .cuda(), which would push the data to the default device.
If you haven’t masked the GPUs via CUDA_VISIBLE_DEVICES, it should use GPU0.
Also, Variables are deprecated since PyTorch 0.4, so you can use tensors directly in newer versions.