import math


def normal_log_density(x, mean, log_std, std):
    """Returns normalized log density, aka normal distribution, aka Gaussian distribution

    Args:
        x: input
        mean: mean
        log_std: log standard deviation
        std: standard deviation

    Returns:
        normalized log density
    """
    var = std.pow(2)
    log_density = -(x - mean).pow(2) / (2 * var) - 0.5 * math.log(2 * math.pi) - log_std
    nld = log_density.sum(1, keepdim=True)
    return nld