Return NotImplemented from all binary math ops#27423
Return NotImplemented from all binary math ops#27423peterbell10 wants to merge 7 commits intopytorch:masterfrom
Conversation
torch/tensor.py
Outdated
There was a problem hiding this comment.
Can you remind me why we don't implement the wrapping here directly in C++?
There was a problem hiding this comment.
It doesn't make sense to return NotImplemented from Tensor.eq which is what this is wrapping.
test/test_torch.py
Outdated
There was a problem hiding this comment.
This is well-written and makes good use of the existing test infrastructure. It may be test overkill to add hundreds of tests for this behavior, but as long as these take <1s to run it's fine. (You can check the timestamps in the CI.)
ezyang
left a comment
There was a problem hiding this comment.
OK. I'll leave a little time for mruberry to take a look and then merge.
test/test_torch.py
Outdated
There was a problem hiding this comment.
Not "TestDevicePrecision" per below. You should acquire the class name from cls.
|
I strongly suspect the onnx test failures are real. Probbabbbly just accepting the changes should be fine |
|
I'm not familiar with ONNX, does it depend on the parameter names in the function signature? If that's the case then could this error be caused by |
|
@houseroad for ONNX question |
|
@peterbell10 Yes, I don't exactly remember how argument name inference is done, but it certainly seems plausible that decorator is thwarting (or un-thwarting, perhaps) the name inference. The names are all advisory anyway; if the graphs are alpha-equivalent either is fine. |
Okay, in that case I've just updated the test cases. |
|
@pytorchbot rebase this please |
facebook-github-bot
left a comment
There was a problem hiding this comment.
@ezyang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
Sorry, it looks like this merge conflicts now :( |
6ea268b to
15bf25b
Compare
|
Still failing tests |
15bf25b to
a49c663
Compare
|
Should be fixed now. |
|
@pytorchbot rebase this please |
facebook-github-bot
left a comment
There was a problem hiding this comment.
@ezyang is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Fixes #26333
Fixes the operators missed in #26507 and includes a test for all operators.