-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Updates nonzero's as_tuple behavior to no longer warn. #45413
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
💊 CI failures summary and remediationsAs of commit 854368f (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following CI failures do not appear to be due to upstream breakages:
|
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.
@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
that deprecation plan does sound superior. |
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.
does the JIT do the right thing?
That's a good question. Let's extend the test for it. |
|
As expected, scripting with as_tuple does not work (see #45499). This is not a regression. Tracing with as_tuple DOES work. |
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.
@mruberry 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.
@mruberry 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.
@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
tools/autograd/templates/python_variable_methods.cpp also needs to be updated. With the current status, 1.7 will have inconsistent warning behavior between |
Summary: Reverting the diff because it has already been fixed in pytorch/pytorch#45413 Reviewed By: myleott Differential Revision: D24511658 fbshipit-source-id: a5561dae50d69a03443ca8a60bebe2cd064e3ee0
Summary: Fixes #44284 #45413 incorrectly left this only partially fixed because it did not update the separate list of method signatures that were deprecated. This PR correctly fixes #44284. A test is added for the behavior, but until the WARN_ONCE flag is added it's toothless. Pull Request resolved: #51618 Reviewed By: ngimel Differential Revision: D26220181 Pulled By: mruberry fbshipit-source-id: 397b47ac7e962d108d8fde0f3dc6468d6327d1c3
Summary: Reverting the diff because it has already been fixed in pytorch/pytorch#45413 Reviewed By: myleott Differential Revision: D24511658 fbshipit-source-id: a5561dae50d69a03443ca8a60bebe2cd064e3ee0
Summary: Reverting the diff because it has already been fixed in pytorch/pytorch#45413 Reviewed By: myleott Differential Revision: D24511658 fbshipit-source-id: a5561dae50d69a03443ca8a60bebe2cd064e3ee0
Fixes #44284.
torch.nonzero is distinct from numpy.nonzero. The latter returns a tensor by default, and the former returns a tuple of tensors. The
as_tupleargument was added as part of an intended deprecation process to make torch.nonzero consistent with numpy.nonzero, but this was a confusing change for users. A better deprecation path would be to offer torch.argwhere consistent with numpy.argwhere, which is equivalent to the default torch.nonzero behavior. Once this is offered a change to torch.nonzero should be more straightforward with less user disruption, if we decided that's the correct change to pursue.