Use both absolute and relative tolerance in testing (#34258)

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

This PR allows both atol and rtol to be specified, uses defaults based on the prior analysis (spreadsheet attached to https://github.com/pytorch/pytorch/pull/32538), but retains the absolute tolerance behavior in cases where precision was previously specified explicitly.

Test Plan: Imported from OSS

Differential Revision: D21110255

Pulled By: nairbv

fbshipit-source-id: 57b3a004c7d5ac1be80ee765f03668b1b13f4a7e
This commit is contained in:
Brian Vaughan
2020-04-19 06:14:27 -07:00
committed by Facebook GitHub Bot
parent 3aec9f7924
commit 54ed6fd3ee
13 changed files with 323 additions and 261 deletions

View File

@ -488,7 +488,7 @@ class TestFuser(JitTestCase):
with torch.jit.optimized_execution(False):
out_noopt = model_noopt(x, y)
rep_noopt = str(model_noopt.graph_for(x, y))
self.assertEqual(out, out_noopt, prec=3e-5)
self.assertEqual(out, out_noopt, atol=3e-5)
# Check that normalization op has really been decomposed
for node_in_graph in in_opt_graph: