-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use torch.testing.assert_close in common_utils.py #3873
Use torch.testing.assert_close in common_utils.py #3873
Conversation
@@ -139,7 +141,8 @@ def assertExpected(self, output, name, prec=None): | |||
raise RuntimeError("The output for {}, is larger than 50kb".format(filename)) | |||
else: | |||
expected = torch.load(expected_file) | |||
self.assertEqual(output, expected, prec=prec) | |||
rtol = atol = prec or self.precision |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for ref self.assertEqual
is currently setting prec
to self.precision
if it's None (as done above)
and the check was
tolerance = prec + prec * abs(a.max())
self.assertLessEqual(max_err, tolerance, message)
So the changes LGTM here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't approve as I'm the PR author, but this is @pmeier 's work, LGTM when green
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stamping
…ion into assert_close_common_utils
Summary: Co-authored-by: Philip Meier <[email protected]> Reviewed By: vincentqb, cpuhrsch Differential Revision: D28679991 fbshipit-source-id: 46e760f6c01c4a8147f5ec373f682b6da96e295a
part of #3865