mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
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:
parent
64d083bb86
commit
e3414c1ef1
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user