def detach_var(var):
    """Detaches a var from torch

    Args:
        var (torch var): Torch variable that requires grad

    Returns:
        TYPE: numpy array
    """
    return var.cpu().detach().numpy()