def categorical_crossentropy(coding_dist, true_dist):
    if true_dist.ndim == coding_dist.ndim:
        return -tensor.sum(true_dist * tensor.log(coding_dist),
                           axis=coding_dist.ndim - 1)
    elif true_dist.ndim == coding_dist.ndim - 1:
        return crossentropy_categorical_1hot(coding_dist, true_dist)
    else:
        raise TypeError('rank mismatch between coding and true distributions')
Return the cross-entropy between an approximating distribution and a true
dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/tensor/nnet/nnet.py/categorical_crossentropy