Hi Iv!



 ivprgrmmr:

loss = -ylog(x), with y=1 and x=0.3712, I get a loss of 0.4304.


Your notation here (“log(x)”) is ambiguous, but you are using the
so-called common logarithm (log-base-10) in your calculation.
You should be using the "natural logarithm* (log-base-e), instead.
The natural logarithm is the correct choice (and is what pytorch is
using).
Note that pytorch’s torch.log() and python’s math.log() give you the
natural logarithm.  (They both use log10() for the common logarithm.)
Best.
K. Frank