import torch
import math


def entropy_conditioned(logvar: torch.Tensor) -> torch.Tensor:
    """ Conditioned entropy.

    Args:
        logvar: :math:`\\log\\sigma_i^2`, shape (B, L)

    Returns:
        :math:`H(z_i|x)`, shape (L, )
    """

    return ((logvar + math.log(math.pi * 2) + 1) * 0.5).mean(dim=0)