import torch


def to_device(data, device):
    """Move data to device
    
    Arguments:
        data {TupleTree, tensor} -- Tensors that should be moved to device.
        device {str, torch.device} -- Device data is moved to.
    
    Returns:
        TupleTree, tensor -- Data moved to device
    """
    if type(data) is not torch.Tensor:
        raise RuntimeError(f"Need 'data' to be tensors, not {type(data)}.")
    return data.to(device)