From 3c44556cebd836be2bef54d6deaeb63fbd893842 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 19 Oct 2016 16:47:51 -0800 Subject: [PATCH] Updates OSS Eigen version to get bug fix for negative arguments to sqrt. Adds unit tests for handling negative arguments to tf.sqrt. Followup to cl/135111959. Change: 136665526 --- .../python/kernel_tests/cwise_ops_test.py | 19 +++++++++++++++++++ tensorflow/workspace.bzl | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/tensorflow/python/kernel_tests/cwise_ops_test.py b/tensorflow/python/kernel_tests/cwise_ops_test.py index f89bc5a0348..cef8bfd17b0 100644 --- a/tensorflow/python/kernel_tests/cwise_ops_test.py +++ b/tensorflow/python/kernel_tests/cwise_ops_test.py @@ -1738,6 +1738,25 @@ class IsFiniteInfNanTest(tf.test.TestCase): def testDouble(self): self._testDtype(np.float64) + def testSqrt(self): + for dtype in [np.float16, np.float32, np.float64]: + fi = np.finfo(dtype) + for size in [1, 3, 4, 7, 8, 63, 64, 65]: + # For float32 Eigen uses Carmack's fast vectorized sqrt algorithm. + # It is not accurate for very large arguments, so we test for + # fi.max/100 instead of fi.max here. + for value in [fi.min, -2, -1, 0, fi.tiny, 1, 2, 1000, fi.max/100]: + x = np.full((size,), value, dtype=dtype) + np_y = np.sqrt(x) + np_nan = np.isnan(np_y) + with self.test_session(use_gpu=True): + tf_y = tf.sqrt(x) + tf_nan = tf.is_nan(tf_y) + if value < 0: + self.assertAllEqual(np_nan, tf_nan.eval()) + else: + self.assertAllCloseAccordingToType(np_y, tf_y.eval()) + class RoundingTest(tf.test.TestCase): diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl index 1b555c40cd8..07fd0b3cff6 100644 --- a/tensorflow/workspace.bzl +++ b/tensorflow/workspace.bzl @@ -14,8 +14,8 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""): # These lines need to be changed when updating Eigen. They are parsed from # this file by the cmake and make builds to determine the eigen version and # hash. - eigen_version = "f6508f52a798" - eigen_sha256 = "9824d3beea839455e496ea472e4dcf05f7e25ec01dfb68e540fbfe522b609f72" + eigen_version = "1c7159a65db4" + eigen_sha256 = "b089a6eae493c32703c6beb5fdae9d64a7667c3a5440bae00ac8e517cc822e62" native.new_http_archive( name = "eigen_archive", -- GitLab