What is the difference between softmax and log-softmax?
The difference between these two functions that has been described in this pytorch post: What is the difference between log_softmax and softmax?
 is: exp(x_i) / exp(x).sum()
and log softmax is: log(exp(x_i) / exp(x).sum()).

But for the Pytorch code below why am I getting different output:

&gt;&gt;&gt; it = autograd.Variable(torch.FloatTensor([0.6229,0.3771]))
&gt;&gt;&gt; op = autograd.Variable(torch.LongTensor([0]))
&gt;&gt;&gt; m  = nn.Softmax()
&gt;&gt;&gt; log = nn.LogSoftmax()
&gt;&gt;&gt; m(it)
Variable containing:
`0.5611  0.4389`
[torch.FloatTensor of size 1x2]
&gt;&gt;&gt;log(it)
Variable containing:
-0.5778 -0.8236
[torch.FloatTensor of size 1x2]


However, the value log(0.5611) is -0.25095973129 and log(0.4389) is -0.35763441915

Why is there such discrepancy?

By default, torch.log provides the natural logarithm of the input, so the output of PyTorch is correct: 

ln([0.5611,0.4389])=[-0.5778,-0.8236]


Your last results are obtained using the logarithm with base 10.
