You would have to reassign the tensor when calling the to() operator:
    if torch.cuda.is_available():
        img_tensor = img_tensor.cuda()

Also, you need to call cuda() or to('cuda') on the model as well.
Note that Variables are deprecated since PyTorch 0.4, so you can use tensors in newer versions.