def log_standard_categorical(p):
    """
    Computes the cross-entropy between a (one-hot) categorical vector and a standard (uniform) categorical distribution.
    :param p: one-hot categorical distribution
    :return: H(p,u)
    """
    eps = 1e-8
    prior = F.softmax(torch.ones_like(p), dim=1)  # Uniform prior over y
    prior.requires_grad = False
    cross_entropy = -torch.sum(p * torch.log(prior + eps), dim=1)

    return cross_entropy

    Computes the cross-entropy between a (one-hot) categorical vector and a standard (uniform) categorical distribution.
    :param p: one-hot categorical distribution
    :return: H(p,u)
    
adbench/baseline/DeepSAD/src/networks/inference/distributions.py