Reduce precision in doctest.

PiperOrigin-RevId: 290369404
Change-Id: I21f875991a08415f0e1d6fdeb6c3f4f1a00da3f8
This commit is contained in:
Yash Katariya 2020-01-17 17:06:03 -08:00 committed by TensorFlower Gardener
parent 659ff38c2f
commit 0cb9daaee5
2 changed files with 3 additions and 6 deletions

View File

@ -115,8 +115,7 @@ class TfDoctestOutputChecker(doctest.OutputChecker, object):
_ADDRESS_RE = re.compile(r'\bat 0x[0-9a-f]*?>')
def _allclose(self, want, got, rtol=1e-6, atol=1e-6):
# Same default as: tensorflow/python/framework/test_util.py "assertAllClose"
def _allclose(self, want, got, rtol=1e-3, atol=1e-3):
return np.allclose(want, got, rtol=rtol, atol=atol)
def check_output(self, want, got, optionflags):

View File

@ -128,10 +128,8 @@ class TfDoctestOutputCheckerTest(parameterized.TestCase):
@parameterized.parameters(
# CHeck examples out of tolerence.
['1.001e-6', [0]],
['0.0', [1.001e-6]],
['1.000001001e9', [1e9]],
['1e9', [1.000001001e9]],
['1.001e-2', [0]],
['0.0', [1.001e-3]],
)
def test_fail_tolerences(self, text, expected_floats):
extract_floats = tf_doctest_lib._FloatExtractor()