diff options
Diffstat (limited to 'tensorflow/python/kernel_tests/cast_op_test.py')
-rw-r--r-- | tensorflow/python/kernel_tests/cast_op_test.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tensorflow/python/kernel_tests/cast_op_test.py b/tensorflow/python/kernel_tests/cast_op_test.py index 17771e0572..c785f2358d 100644 --- a/tensorflow/python/kernel_tests/cast_op_test.py +++ b/tensorflow/python/kernel_tests/cast_op_test.py @@ -20,6 +20,7 @@ from __future__ import print_function import numpy as np import sys +import platform from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes @@ -146,9 +147,16 @@ class CastOpTest(test.TestCase): if sys.byteorder == "big": self._compare(np.inf, np.int32, i4.max, False) self._compare(np.inf, np.int64, i8.max, False) - else: - self._compare(np.inf, np.int32, i4.min, False) - self._compare(np.inf, np.int64, i8.min, False) + else: + # np.float64("np.inf").astype(np.int32) is negative on x86 but positive on ppc64le + # Numpy link to relevant discussion - https://github.com/numpy/numpy/issues/9040 + # Tensorflow link to relevant discussion - https://github.com/tensorflow/tensorflow/issues/9360 + if platform.machine() == "ppc64le": + self._compare(-np.inf, np.int32, i4.min, False) + self._compare(-np.inf, np.int64, i8.min, False) + else: + self._compare(np.inf, np.int32, i4.min, False) + self._compare(np.inf, np.int64, i8.min, False) self._compare(-np.inf, np.float32, -np.inf, False) self._compare(-np.inf, np.float64, -np.inf, False) self._compare(-np.inf, np.int32, i4.min, False) |