Enable half type support for unique cpu (#91666)

Test Plan: CI

Differential Revision: D42326527

Pull Request resolved: https://github.com/pytorch/pytorch/pull/91666
Approved by: https://github.com/jgong5, https://github.com/ngimel
This commit is contained in:
Zheng Yan
2023-02-16 04:59:35 +00:00
committed by PyTorch MergeBot
parent 04b4704a0b
commit 753c33bf86
5 changed files with 30 additions and 24 deletions

View File

@ -826,7 +826,7 @@ class TestSortAndSelect(TestCase):
self.assertEqual(expected_inverse.view(additional_shape), y_inverse)
self.assertEqual(expected_counts, y_counts)
@dtypesIfCPU(*all_types_and(torch.bool, torch.bfloat16))
@dtypesIfCPU(*all_types_and(torch.bool, torch.float16, torch.bfloat16))
@dtypes(*all_types_and(torch.half, torch.bool))
def test_unique(self, device, dtype):
def ensure_tuple(x):
@ -883,7 +883,7 @@ class TestSortAndSelect(TestCase):
count += 1
self.assertEqual(j, count)
@dtypesIfCPU(*all_types_and(torch.bool, torch.bfloat16))
@dtypesIfCPU(*all_types_and(torch.bool, torch.float16, torch.bfloat16))
@dtypes(*all_types_and(torch.half, torch.bool))
def test_unique_consecutive(self, device, dtype):
if dtype is torch.bool: