import torch


def to_device(tensor):
    """
    Move tensor to device. If GPU is is_available, move to GPU.
    """
    if torch.cuda.is_available():
        return tensor.cuda()
    else:
        return tensor