Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added the exception of ignore_index#18117

Closed
bharatr21 wants to merge 5 commits into
pytorch:masterfrom
bharatr21:ignore-index
Closed

Added the exception of ignore_index#18117
bharatr21 wants to merge 5 commits into
pytorch:masterfrom
bharatr21:ignore-index

Conversation

@bharatr21
Copy link
Copy Markdown
Contributor

Fix #17801 to add an exception regarding ignore_index in the documentation for torch.nn.CrossEntropyLoss and torch.nn.NLLLoss

If any other files/functions are hit, I'd be glad to incorporate the changes there too! 😊

@ezyang
Copy link
Copy Markdown
Contributor

ezyang commented Mar 19, 2019

I think the wording here is still confusing. @tomahawk810, do you have any opinions here?

@tomahawk810
Copy link
Copy Markdown

I think it helps but indeed the wording could be more accurate. I find the "except" not ideal.
Here is a proposition to replace the added text between parentheses:

Additionally to that range of values, any integer specified by ignore_index is also allowed in target.

@ezyang
Copy link
Copy Markdown
Contributor

ezyang commented Mar 20, 2019

@tomahawk810 I copy-edited it some more. Please take a look and see if it looks clear to you.

@tomahawk810
Copy link
Copy Markdown

@ezyang looks good to me.

Note that there is a typo: a double ";" on line 856

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ezyang is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
Fix pytorch#17801 to add an exception regarding `ignore_index` in the documentation for `torch.nn.CrossEntropyLoss` and `torch.nn.NLLLoss`

If any other files/functions are hit, I'd be glad to incorporate the changes there too! 😊
Pull Request resolved: pytorch#18117

Differential Revision: D14542079

Pulled By: ezyang

fbshipit-source-id: 7b918ac61f441dde7d3d6782d080c500cf2097f1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

torch.nn.CrossEntropyLoss (and related losses): misleading regarding ignore_index

5 participants