Slightly relax numeric tolerance for sinlge precision tests of matrix_solve_ls (and tighten it for double precision).

PiperOrigin-RevId: 165750936
This commit is contained in:
A. Unique TensorFlower 2017-08-18 14:13:35 -07:00 committed by TensorFlower Gardener
parent eebcc861ac
commit cdc08afbb2

View File

@ -87,7 +87,11 @@ class MatrixSolveLsOpTest(test.TestCase):
self.assertAllClose(np_r_norm, tf_r_norm)
# Check solution.
self.assertAllClose(np_ans, ans, atol=1e-5, rtol=1e-5)
if np_type == np.float32 or np_type == np.complex64:
tol = 5e-5
else:
tol = 1e-12
self.assertAllClose(np_ans, ans, atol=tol, rtol=tol)
def _verifySolveBatch(self, x, y):
# Since numpy.linalg.lsqr does not support batch solves, as opposed