def normalize_mean_var(x: Tensor, dim: int = -1, eps: float = 1.0e-6) -> Tensor:
    """Normalizes the input tensor to zero mean and unit variance.

    Args:
        x:
            Input tensor.
        dim:
            Dimension along which to compute mean and standard deviation. Takes last
            dimension by default.
        eps:
            Epsilon value to avoid division by zero.

    Returns:
        Normalized tensor.
    """
    mean = x.mean(dim=dim, keepdim=True)
    var = x.var(dim=dim, keepdim=True)
    return (x - mean) / (var + eps).sqrt()
Normalizes the input tensor to zero mean and unit variance.

    Args:
        x:
            Input tensor.
        dim:
            Dimension along which to compute mean and standard deviation. Takes last
            dimension by default.
        eps:
            Epsilon value to avoid division by zero.

    Returns:
        Normalized tensor.
    
lightly/models/utils.py