def decorated(self, *args, **kwargs): allowed = config.tensor_float_32_execution_enabled() try: config.enable_tensor_float_32_execution(False) f(self, *args, **kwargs) finally: config.enable_tensor_float_32_execution(allowed)
def setUp(self): self.tf32_keep_ = config.tensor_float_32_execution_enabled() config.enable_tensor_float_32_execution(False) # Increase from 1e-6 to 1e-4 self._atol[dtypes.float32] = 1e-4 self._atol[dtypes.complex64] = 1e-4 self._rtol[dtypes.float32] = 1e-4 self._rtol[dtypes.complex64] = 1e-4
def test_tensor_float_32_global_variable(self): self.assertTrue(config.tensor_float_32_execution_enabled()) self.assertTrue(test_ops.is_tensor_float32_enabled()) config.enable_tensor_float_32_execution(False) self.assertFalse(config.tensor_float_32_execution_enabled()) self.assertFalse(test_ops.is_tensor_float32_enabled()) config.enable_tensor_float_32_execution(True) self.assertTrue(config.tensor_float_32_execution_enabled()) self.assertTrue(test_ops.is_tensor_float32_enabled())
def setUp(self): self.tf32_keep_ = config.tensor_float_32_execution_enabled() config.enable_tensor_float_32_execution(False) # Increase from 1e-6 to 1e-4 self._atol[dtypes.float32] = 1e-4 self._atol[dtypes.complex64] = 1e-4 self._rtol[dtypes.float32] = 1e-4 self._rtol[dtypes.complex64] = 1e-4 super(NonSquareLinearOperatorBlockDiagTest, self).setUp()
def setUp(self): self.tf32_keep_ = config.tensor_float_32_execution_enabled() config.enable_tensor_float_32_execution(False) # Decrease tolerance since we are testing with condition numbers as high as # 1e4. self._atol[dtypes.float32] = 1e-5 self._rtol[dtypes.float32] = 1e-5 self._atol[dtypes.float64] = 1e-10 self._rtol[dtypes.float64] = 1e-10 self._rtol[dtypes.complex64] = 1e-4
def test_tensor_float_32_disabled(self): self.assertTrue(config.tensor_float_32_execution_enabled()) config.enable_tensor_float_32_execution(False) self.assertFalse(config.tensor_float_32_execution_enabled()) x = array_ops.fill((8, 8), 1 + 2**-20) y = array_ops.ones((8, 8)) out = math_ops.matmul(x, y) expected = array_ops.fill((8, 8), 8 * (1 + 2**-20)) self.assertAllEqual(out, expected)
def setUp(self): self.tf32_keep_ = config.tensor_float_32_execution_enabled() config.enable_tensor_float_32_execution(False) # Decrease tolerance since we are testing with condition numbers as high as # 1e4. This class does not use Cholesky, and thus needs even looser # tolerance. self._atol[dtypes.float32] = 1e-4 self._rtol[dtypes.float32] = 1e-4 self._atol[dtypes.float64] = 1e-9 self._rtol[dtypes.float64] = 1e-9 self._rtol[dtypes.complex64] = 2e-4
def setUp(self): self.tf32_keep_ = config.tensor_float_32_execution_enabled() config.enable_tensor_float_32_execution(False)
def tearDown(self): config.enable_tensor_float_32_execution(self.tf32_keep_)
def tearDown(self): super(TensorFloat32Test, self).tearDown() config.enable_tensor_float_32_execution(True)
math_ops.matmul(operator1.to_dense(), operator2.to_dense()), self.evaluate(operator_matmul.to_dense())) operator_matmul = operator2.matmul(operator1) self.assertTrue( isinstance(operator_matmul, linalg_lib.LinearOperatorLowerTriangular)) self.assertAllClose( math_ops.matmul(operator2.to_dense(), operator1.to_dense()), self.evaluate(operator_matmul.to_dense())) def test_tape_safe(self): tril = variables_module.Variable([[1., 0.], [0., 1.]]) operator = linalg_lib.LinearOperatorLowerTriangular( tril, is_non_singular=True) self.check_tape_safe(operator) def test_convert_variables_to_tensors(self): tril = variables_module.Variable([[1., 0.], [0., 1.]]) operator = linalg_lib.LinearOperatorLowerTriangular( tril, is_non_singular=True) with self.cached_session() as sess: sess.run([tril.initializer]) self.check_convert_variables_to_tensors(operator) if __name__ == "__main__": config.enable_tensor_float_32_execution(False) linear_operator_test_util.add_tests(LinearOperatorLowerTriangularTest) test.main()
def setUp(self): self.tf32_keep_ = config.tensor_float_32_execution_enabled() config.enable_tensor_float_32_execution(False) self._atol[dtypes.complex64] = 1e-5 self._rtol[dtypes.complex64] = 1e-5