import torch


def cross_entropy(targ, pred):
    """
    Take the cross-entropy between predicted and target.
    Args:
        targ (torch.Tensor): target
        pred (torch.Tensor): prediction
    Returns:
        diff (torch.Tensor): cross-entropy.
    """

    targ = targ.to(torch.float)
    fn = torch.nn.BCELoss(reduction='none')
    diff = fn(pred, targ)

    return diff