def _l1_regularization(l1, model):
    """Computes the L1 regularization for the given model

    Args:
        l1 (float): L1 parameter
        model (:obj:`torch.nn.Module`): Model to use

    Returns:
        float: L1 loss (i.e. l1 * l1_norm(params))
    """
    l1_loss = sum(param.norm(1) for param in model.parameters())
    return l1 * l1_loss