Enable torch.isclose to suppport bool tensors (#61271)

Summary:
Fixes https://github.com/pytorch/pytorch/issues/60533

Pull Request resolved: https://github.com/pytorch/pytorch/pull/61271

Reviewed By: zhxchen17

Differential Revision: D29737618

Pulled By: SplitInfinity

fbshipit-source-id: 45314bc7e0b9a28c10700455b1e6267c0db3eefc
This commit is contained in:
Xue Haotian
2021-07-21 18:34:56 -07:00
committed by Facebook GitHub Bot
parent 243c7079a1
commit 3d6aa3a2f6
2 changed files with 5 additions and 7 deletions

View File

@ -244,8 +244,6 @@ class TestTesting(TestCase):
expected = test[2]
self.assertEqual(actual.item(), expected)
# torch.close is not implemented for bool tensors
# see https://github.com/pytorch/pytorch/issues/33048
def test_isclose_comparetensors_bool(self, device):
tests = (
(True, True, True),
@ -254,9 +252,7 @@ class TestTesting(TestCase):
(False, True, False),
)
with self.assertRaises(RuntimeError):
self._isclose_helper(tests, device, torch.bool, False)
self._isclose_helper(tests, device, torch.bool, False)
self._comparetensors_helper(tests, device, torch.bool, False)
@dtypes(torch.uint8,