-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Extend torch function support to ALL arguments, not just scalar type (but not insides of list) #145089
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
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/145089
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit ac58da9 with merge base 2507ae6 ( UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
… type (but not insides of list) Signed-off-by: Edward Z. Yang <[email protected]> ghstack-source-id: 389c821 Pull Request resolved: #145089
|
The specific problem relates to torch function redispatch. Consider the argument overload list for Tensor.set_: This says we attempt to resolve the Storage overload before the Tensor overload. When a Tensor has a So maybe we need some special case saying that if something is a Tensor, it doesn't match for non-Tensor arguments? Hmm... |
… type (but not insides of list) Signed-off-by: Edward Z. Yang <[email protected]> ghstack-source-id: 17fc269 Pull Request resolved: #145089
… type (but not insides of list) Signed-off-by: Edward Z. Yang <[email protected]> ghstack-source-id: dcef210 Pull Request resolved: #145089
|
Sure I'm in no hurry for this to land, we can talk about the implications once you're back! |
|
We ballin' this |
… type (but not insides of list) Signed-off-by: Edward Z. Yang <[email protected]> ghstack-source-id: de8ef4a Pull Request resolved: #145089
albanD
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.
yolo I guess? Not sure if we want more extensive testing for this..
| // that internally | ||
| if (check_has_torch_function(obj, /*ignore_mode*/ true) && | ||
| !THPVariable_Check(obj)) { | ||
| // tensor subclasses and unrelated objects with __torch_function__ |
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.
This needs updating as only non-subclass are caught here actually.
|
@pytorchbot merge |
… type (but not insides of list) Signed-off-by: Edward Z. Yang <[email protected]> ghstack-source-id: 3046eb6 Pull Request resolved: #145089
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…(but not insides of list) (pytorch#145089) Signed-off-by: Edward Z. Yang <[email protected]> Pull Request resolved: pytorch#145089 Approved by: https://github.com/albanD, https://github.com/zou3519
…(but not insides of list) (pytorch#145089) Signed-off-by: Edward Z. Yang <[email protected]> Pull Request resolved: pytorch#145089 Approved by: https://github.com/albanD, https://github.com/zou3519
Stack from ghstack (oldest at bottom):
Signed-off-by: Edward Z. Yang [email protected]
cc @albanD