Cross-entropy is usually computed as log-softmax followed by NLL, which avoids taking the log of a tiny probability.
Implement:
log_softmax(z) over the last axis: computed with the log-sum-exp tricknll(log_probs, targets): mean of for integer class targets