Could you also help me with the differences between tf/pytorch and numpy. It seems to be working fine when the input is 2d, but when the input has more than 2 dimensions it doesn’t. For example now I’m trying with a 4d array where the distributions are on the last axis. This is my implementation:
 np.mean(np.sum(preds * np.log(preds / labels), axis=-1))

Thanks in advance.