import torch


def cross_entropy(pred, target):
    """
    "Proper" cross entropy between distributions.

    :param pred: predicted logits
    :type pred: torch.autograd.Variable
    :param target: target distributions
    :type target: torch.autograd.Variable
    :return: loss
    :rtype: torch.autograd.Variable
    """

    return torch.sum(- target * torch.nn.functional.log_softmax(pred, 1), 1)