Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Softmax to LogSoftmax to use NLLLoss. #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

daa233
Copy link
Contributor

@daa233 daa233 commented Mar 16, 2018

Fix #3.

From here, it is LogSoftmax should be used for NLLLoss, instead of Softmax.

This module doesn’t work directly with NLLLoss, which expects the Log to be computed between the Softmax and itself. Use LogSoftmax instead (it’s faster and has better numerical properties).

@chaeunl
Copy link

chaeunl commented Mar 31, 2019

That's right. CrossEntropyLoss = LogSoftmax + NLLLoss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants