Hello KFrank!
Thank you for your comprehensive reply! It is really helpful. I am really sorry for my unclear and unfriendly expression.  I think the small round-off  error is acceptable and not the cause of the error. It may have overflowed or some other error when executing ‘F.softmax’ or ‘log’ (But I have subtracted the maximum to prevent the softmax overflow). I will continue to debug the code for the real reason. In fact, I need to apply an attention map to the result of ‘F.softmax’ to calculate a new probability distribution. And then use the new probability distribution to calculate the loss. I willl try to re-exponentiate  log_softmax()  to recover  softmax(). Thank you again for your reply, it helps me a lot.