More descriptive error message for torch.nanmean() with complex dtypes (#153252)

Fixes #153132

Pull Request resolved: https://github.com/pytorch/pytorch/pull/153252
Approved by: https://github.com/colesbury
This commit is contained in:
Narek Malkhasyan
2025-05-26 05:42:54 +00:00
committed by PyTorch MergeBot
parent b6868f290e
commit 21e42c5d62
3 changed files with 3 additions and 3 deletions

View File

@ -1792,7 +1792,7 @@ class TestReductions(TestCase):
@dtypes(*complex_types())
def test_nansum_complex(self, device, dtype):
x = torch.randn((3, 3, 3), device=device, dtype=dtype)
with self.assertRaisesRegex(RuntimeError, "nansum does not support complex inputs"):
with self.assertRaisesRegex(RuntimeError, "nansum on CPU does not support complex inputs"):
torch.nansum(x)
@dtypes(*all_types_and(torch.half))