Closed pyedog1976 closed 2 years ago
Hello!
Yes, using log-softmax and cross-entropy should be mathematically the same. The difference here is very minimal and indeed can be caused by floating error, or implementation difference.
Thanks for your reply, and I'm tending to say the floating error can be the reason.
Dear Author,
Thanks a lot for providing the code.
In your reco loss computation,
I think the cross entropy part is equivalent with the nll loss and manually picks the positive index from the softmax outputs, as shown below:
However, I've found there always be slight different between those two computation ways, for example:
My question is, do you think such different is caused by the floating point error? Am I misunderstand something?
Thanks.
Regards