-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Added dim check for index_copy_ #21617
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
Conversation
facebook-github-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@izdeby has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
facebook-github-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@izdeby has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
Test fail seems legit: |
aten/src/ATen/native/Indexing.cpp
Outdated
| if (source.dim() == 0 && numIndices != 1) { | ||
| AT_INDEX_ERROR("index_copy_(): When source is scalar, index should have one element (got ", numIndices, ")"); | ||
| } else if (source.dim() != self.dim()) { | ||
| AT_INDEX_ERROR("index_copy_(): When source is not scalar, its dimensionality must match the dimensionality of the destination"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's nice to also list the dimensionalities so the user doesn't have to print out the tensors.
Something like:
index_copy_(): When source is not scalar, its dimensionality (3) must match the dimensionality of the destination (2)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, the error message doesn't match what is checked -- the message says source is not a scalar, but this isn't actually checked.
VitalyFedyunin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test fail seems legit: ERROR: test_index_copy_scalar_input_dim (__main__.TestAutograd)
gchanan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test?
facebook-github-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@izdeby has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
why does this not have a test? |
Summary: Fixing reported [bug](pytorch/pytorch#20322) The issue was related to not checking the dimensions of source vs destination tensors. Pull Request resolved: pytorch/pytorch#21617 Differential Revision: D15749963 Pulled By: izdeby fbshipit-source-id: acff114c729fd9c0a9a51325e0ebd8b42e1f2fc1
Fixing reported bug
The issue was related to not checking the dimensions of source vs destination tensors.