diff --git a/tensorflow/contrib/distributions/python/kernel_tests/bijectors/scale_tril_test.py b/tensorflow/contrib/distributions/python/kernel_tests/bijectors/scale_tril_test.py index d5b3367f9a3..1b88c1d130a 100644 --- a/tensorflow/contrib/distributions/python/kernel_tests/bijectors/scale_tril_test.py +++ b/tensorflow/contrib/distributions/python/kernel_tests/bijectors/scale_tril_test.py @@ -41,10 +41,10 @@ class ScaleTriLBijectorTest(test.TestCase): diag_shift=shift) y_ = self.evaluate(b.forward(x)) - self.assertAllClose(y, y_) + self.assertAllClose(y, y_, rtol=1e-4) x_ = self.evaluate(b.inverse(y)) - self.assertAllClose(x, x_) + self.assertAllClose(x, x_, rtol=1e-4) @test_util.run_in_graph_and_eager_modes def testInvertible(self): @@ -52,18 +52,18 @@ class ScaleTriLBijectorTest(test.TestCase): # Generate random inputs from an unconstrained space, with # event size 6 to specify 3x3 triangular matrices. batch_shape = [2, 1] - x = np.float32(np.random.randn(*(batch_shape + [6]))) + x = np.float32(self._rng.randn(*(batch_shape + [6]))) b = bijectors.ScaleTriL(diag_bijector=bijectors.Softplus(), diag_shift=3.14159) y = self.evaluate(b.forward(x)) self.assertAllEqual(y.shape, batch_shape + [3, 3]) x_ = self.evaluate(b.inverse(y)) - self.assertAllClose(x, x_) + self.assertAllClose(x, x_, rtol=1e-4) fldj = self.evaluate(b.forward_log_det_jacobian(x, event_ndims=1)) ildj = self.evaluate(b.inverse_log_det_jacobian(y, event_ndims=2)) - self.assertAllClose(fldj, -ildj) + self.assertAllClose(fldj, -ildj, rtol=1e-4) if __name__ == "__main__": test.main()