From 960e0d8ea823d8ac0dc1070f44fd26887d73ebe0 Mon Sep 17 00:00:00 2001 From: Tres Popp Date: Fri, 13 Mar 2020 06:53:10 -0700 Subject: [PATCH] Disable XLA:CPU fast math on some tests needing infinities. PiperOrigin-RevId: 300747481 Change-Id: I53ae5308d4c0a0945f9e37d4e42586e9d8d64f25 --- tensorflow/compiler/tests/binary_ops_test.py | 5 +++++ tensorflow/python/kernel_tests/numerics_test.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/tensorflow/compiler/tests/binary_ops_test.py b/tensorflow/compiler/tests/binary_ops_test.py index f42d51dbb3a..8543e8ea2be 100644 --- a/tensorflow/compiler/tests/binary_ops_test.py +++ b/tensorflow/compiler/tests/binary_ops_test.py @@ -19,6 +19,7 @@ from __future__ import division from __future__ import print_function import itertools +import os import numpy as np @@ -1600,4 +1601,8 @@ class BinaryOpsTest(xla_test.XLATestCase): if __name__ == "__main__": + # TODO(b/130689556): XLA CPU does not honor inf/nan which causes problems + os.environ[ + "XLA_FLAGS"] = "--xla_cpu_enable_fast_math=false " + os.environ.get( + "XLA_FLAGS", "") googletest.main() diff --git a/tensorflow/python/kernel_tests/numerics_test.py b/tensorflow/python/kernel_tests/numerics_test.py index 4c77028d8fd..4d31cd45289 100644 --- a/tensorflow/python/kernel_tests/numerics_test.py +++ b/tensorflow/python/kernel_tests/numerics_test.py @@ -18,6 +18,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function +import os + import numpy as np from tensorflow.python.framework import constant_op @@ -177,4 +179,8 @@ class NumericsTest(test.TestCase): if __name__ == "__main__": + # TODO(b/130689556): XLA CPU does not honor inf/nan which causes problems + os.environ[ + "XLA_FLAGS"] = "--xla_cpu_enable_fast_math=false " + os.environ.get( + "XLA_FLAGS", "") test.main()