mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Add dtype checks in meta dispatch for various ordering ops (#159556)
This adds data type checks for the unsupported bool and complex types for argmax/min topk, sort, minimum, maximum. As listed here:0a99b026d6/torch/testing/_internal/common_methods_invocations.py (L21076)
Currently the ops will fail on CPU or CUDA calculation, rather than at meta dispatch stage as with for example max:0a99b026d6/aten/src/ATen/native/TensorCompare.cpp (L285)
. This will catch it early. Pull Request resolved: https://github.com/pytorch/pytorch/pull/159556 Approved by: https://github.com/janeyx99
This commit is contained in:
committed by
PyTorch MergeBot
parent
cd8d8c18f5
commit
077cb38974
@ -179,7 +179,7 @@ class TestSortAndSelect(TestCase):
|
||||
def test_complex_unsupported_cpu(self):
|
||||
x = torch.tensor([3.0 + 2j, 4.0 + 3j])
|
||||
with self.assertRaisesRegex(
|
||||
ValueError, "Sort currently does not support complex dtypes on CPU."
|
||||
RuntimeError, " Sort does not support complex dtypes on CPU"
|
||||
):
|
||||
torch.sort(input=x)
|
||||
|
||||
|
Reference in New Issue
Block a user