Ruochen
(Ruochen)
February 5, 2022, 1:02am
#1
I just slightly changed SoftMax to make sure that if input is 0, then output will be 0 as well.
but I got the error image from the loss function:
RuntimeError: Function ‘LogBackward0’ returned nan values in its 0th output.

Is that something wrong with the epsilon settings?

my3bikaht
(Sergey)
February 5, 2022, 10:56am
#2
What’s your input tensor? With large enough value you can easily reach +inf for some element due to ~e**2x, which will lead to nan after division

Can you share a minimal reproducible example? I can see your function could failing in the case of `eps=0`

and your `x`

Tensor containing a zero, as you’d be dividing by zero.

Ruochen
(Ruochen)
February 12, 2022, 10:19am
#4
Sorry guys, check my new topics I have put the main error codes there

If you found a solution to this problem, please do share (and mark) the solution so others may learn from it!

Ruochen
(Ruochen)
February 12, 2022, 1:48pm
#6
I am sure I will. Thanks for suggestions