AssertEqual now checks tensors dtype (#34154)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/34154

Temporary replacing with `assertEqualIgnoreType` all cases when `AssertEqual` fails.

Test Plan: Imported from OSS

Differential Revision: D20251131

Pulled By: VitalyFedyunin

fbshipit-source-id: fa69c6e2b3a7963912af5b0fa42bec9eded323d3
This commit is contained in:
Vitaly Fedyunin 2020-05-09 14:44:39 -07:00 committed by Facebook GitHub Bot
parent 64d083bb86
commit e3414c1ef1

View File

@ -870,6 +870,11 @@ class TestCase(expecttest.TestCase):
b_tol = self.get_default_tolerance(b)
return (max(a_tol[0], b_tol[0]), max(a_tol[1], b_tol[1]))
def assertEqualIgnoreType(self, *args, **kwargs):
# If you are seeing this function used, that means test is written wrongly
# and deserves detailed investigation
return self.assertEqual(*args, exact_dtype=False, **kwargs)
def assertEqual(self, x, y, message='', *, atol=None, rtol=None, allow_inf=False, exact_dtype=None):
# we allow setting an absolute tolerance as a positional arg for BC with legacy testing behavior.
if isinstance(message, Number):