import torch


def l1_normalize(x: torch.Tensor, eps: float = 1e-12) -> torch.Tensor:
    """Normalizes the input tensor using L1-norm.

    Args:
        x: Tensor to be normalized.
        eps: Small value to avoid division by zero.

    Returns:
        Normalized tensor.

    """
    return x / (torch.norm(x, p=1, dim=1, keepdim=True) + eps).expand_as(x)