[XLA] Slightly change some test inputs/tolerances

PiperOrigin-RevId: 283774638
Change-Id: I9b5bf178dafe02e18d630e0cb2b867448dade7fa
This commit is contained in:
David Majnemer 2019-12-04 09:45:12 -08:00 committed by TensorFlower Gardener
parent 4f26a9d9c6
commit de4e14925e
2 changed files with 12 additions and 5 deletions

View File

@ -653,7 +653,13 @@ class BinaryOpsTest(xla_test.XLATestCase):
divs = np.arange(-3, 3, .25, dtype=dtype).reshape(1, 24)
np_result = np.true_divide(nums, divs)
np_result[:, divs[0] == 0] = 0
self._testBinary(gen_math_ops.div_no_nan, nums, divs, expected=np_result)
self._testBinary(
gen_math_ops.div_no_nan,
nums,
divs,
expected=np_result,
rtol=7e-15 if dtype == np.float64 else None,
atol=3.9e-15 if dtype == np.float64 else None)
if dtype not in self.complex_types: # floordiv unsupported for complex.
self._testBinary(

View File

@ -164,7 +164,8 @@ class TensorArrayTest(xla_test.XLATestCase):
dtype=tf_dtype, tensor_array_name="foo", size=3)
# Unpack a matrix into vectors.
w1 = ta.unstack(convert([[1.0, 1.1], [2.0, 2.1], [3.0, 3.1]]))
w1 = ta.unstack(
convert([[1.0, 1.03125], [2.0, 2.03125], [3.0, 3.03125]]))
r0 = w1.read(0)
r1 = w1.read(1)
r2 = w1.read(2)
@ -172,9 +173,9 @@ class TensorArrayTest(xla_test.XLATestCase):
d0, d1, d2 = self.evaluate(xla.compile(fn))
self.assertAllEqual(convert([1.0, 1.1]), d0)
self.assertAllEqual(convert([2.0, 2.1]), d1)
self.assertAllEqual(convert([3.0, 3.1]), d2)
self.assertAllEqual(convert([1.0, 1.03125]), d0)
self.assertAllEqual(convert([2.0, 2.03125]), d1)
self.assertAllEqual(convert([3.0, 3.03125]), d2)
def fn():
# Reset ta because we're going to change the shape, else shape