Migrate le/gt/ge/eq/ne from the TH to Aten. Added support of type promotion.#26981
Migrate le/gt/ge/eq/ne from the TH to Aten. Added support of type promotion.#26981ifedan wants to merge 9 commits intopytorch:masterfrom
Conversation
|
You should note in the commit message that this adds some type promotion behavior |
|
"All the comparison operation will follow type promotion described" this makes it vague about if we've added type promotion or not. It would be good to be explicit and say "This PR migrates comparison ops from TH to ATen and adds type promotion in the same way as in #25998". Would also be good to update the PR title to say something about type promotion. |
| }; | ||
|
|
||
| template<typename ScalarTypeOut, typename ScalarType, typename TensorTypeOut, typename TensorType, class Op> | ||
| void THC_logicalValue(THCState *state, |
There was a problem hiding this comment.
I'm not sure if we still need this. However, let's worry about that in the future and not in this PR.
test/test_torch.py
Outdated
| def test_inplace_comparison_ops_require_inputs_have_same_dtype(self): | ||
| with self.assertRaisesRegex(RuntimeError, 'Expected object of scalar type'): | ||
| torch.tensor([1], dtype=torch.int).lt_(torch.tensor([2], dtype=torch.long)) | ||
| torch.tensor([1], dtype=torch.int).le_(torch.tensor([2], dtype=torch.long)) |
There was a problem hiding this comment.
Please clean up these tests by not repeating yourself. If we make this a for loop, it only needs to be 3 lines instead of 6
zou3519
left a comment
There was a problem hiding this comment.
We can repeat ourselves less in the tests but otherwise lgtm. Good work in deleting all those lines of code!
facebook-github-bot
left a comment
There was a problem hiding this comment.
@ifedan has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Test changed based on comment |
facebook-github-bot
left a comment
There was a problem hiding this comment.
@ifedan has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
…motion. (#26981) Summary: pytorch/pytorch#24606 Migrate ne and ne_ from the TH to Aten (CUDA) pytorch/pytorch#24740 Migrate ne and ne_ from the TH to Aten (CPU) pytorch/pytorch#24573 Migrate gt and gt_ from the TH to Aten (CUDA) pytorch/pytorch#24709 Migrate gt and gt_ from the TH to Aten (CPU) pytorch/pytorch#24556 Migrate eq and eq_ from the TH to Aten (CUDA) pytorch/pytorch#24696 Migrate eq and eq_ from the TH to Aten (CPU) pytorch/pytorch#24568 Migrate ge and ge_ from the TH to Aten (CUDA) pytorch/pytorch#24703 Migrate ge and ge_ from the TH to Aten (CPU) pytorch/pytorch#24582 Migrate le and le_ from the TH to Aten (CUDA) pytorch/pytorch#24719 Migrate le and le_ from the TH to Aten (CPU) Performance characteristics are similar to pytorch/pytorch#25998 This PR migrates comparison ops from TH to ATen and adds type promotion in the same way as in pytorch/pytorch#25998 Pull Request resolved: pytorch/pytorch#26981 Differential Revision: D17635651 Pulled By: ifedan fbshipit-source-id: 6ec7615207f5c248a6dd85fc54c25bd5e6d328e6
|
Edit/Update: The revert fixed the cuDNN builds. Looks like this PR did break the cuDNN test builds. |
…motion. (#27017) Summary: pytorch/pytorch#26981 Pull Request resolved: pytorch/pytorch#27017 Differential Revision: D17651454 Pulled By: ifedan fbshipit-source-id: c6313caa11598a0ef160e1c6d2f3c33d03ce80c5
…motion. (pytorch#26981) Summary: pytorch#24606 Migrate ne and ne_ from the TH to Aten (CUDA) pytorch#24740 Migrate ne and ne_ from the TH to Aten (CPU) pytorch#24573 Migrate gt and gt_ from the TH to Aten (CUDA) pytorch#24709 Migrate gt and gt_ from the TH to Aten (CPU) pytorch#24556 Migrate eq and eq_ from the TH to Aten (CUDA) pytorch#24696 Migrate eq and eq_ from the TH to Aten (CPU) pytorch#24568 Migrate ge and ge_ from the TH to Aten (CUDA) pytorch#24703 Migrate ge and ge_ from the TH to Aten (CPU) pytorch#24582 Migrate le and le_ from the TH to Aten (CUDA) pytorch#24719 Migrate le and le_ from the TH to Aten (CPU) Performance characteristics are similar to pytorch#25998 This PR migrates comparison ops from TH to ATen and adds type promotion in the same way as in pytorch#25998 Pull Request resolved: pytorch#26981 Differential Revision: D17635651 Pulled By: ifedan fbshipit-source-id: 6ec7615207f5c248a6dd85fc54c25bd5e6d328e6
…motion. (pytorch#27017) Summary: pytorch#26981 Pull Request resolved: pytorch#27017 Differential Revision: D17651454 Pulled By: ifedan fbshipit-source-id: c6313caa11598a0ef160e1c6d2f3c33d03ce80c5
…motion. (pytorch#27017) Summary: pytorch#26981 Pull Request resolved: pytorch#27017 Differential Revision: D17651454 Pulled By: ifedan fbshipit-source-id: c6313caa11598a0ef160e1c6d2f3c33d03ce80c5
#24606 Migrate ne and ne_ from the TH to Aten (CUDA)
#24740 Migrate ne and ne_ from the TH to Aten (CPU)
#24573 Migrate gt and gt_ from the TH to Aten (CUDA)
#24709 Migrate gt and gt_ from the TH to Aten (CPU)
#24556 Migrate eq and eq_ from the TH to Aten (CUDA)
#24696 Migrate eq and eq_ from the TH to Aten (CPU)
#24568 Migrate ge and ge_ from the TH to Aten (CUDA)
#24703 Migrate ge and ge_ from the TH to Aten (CPU)
#24582 Migrate le and le_ from the TH to Aten (CUDA)
#24719 Migrate le and le_ from the TH to Aten (CPU)
Performance characteristics are similar to #25998
This PR migrates comparison ops from TH to ATen and adds type promotion in the same way as in #25998