def gpu_no_of_var(var):
    """
    Get the GPU-no of a variable
    Args:
        var (torch.autograd.Variable):

    Returns:
        (int) if variable is on GPU
        (false) if variable is not on GPU

    """
    try:
        is_cuda = next(var.parameters()).is_cuda
    except:
        is_cuda = var.is_cuda

    if is_cuda:
        try:
            return next(var.parameters()).get_device()
        except:
            return var.get_device()
    else:
        return False