Skip to content

Commit

Permalink
Merge pull request #52580 from pranve/cherrypick-18cda001c6fbf5433656…
Browse files Browse the repository at this point in the history
…5f4b70bc1265193137b5-on-r2.7

Change test due to np.unique() changing behavior in 1.21.0+
  • Loading branch information
mihaimaruseac committed Oct 19, 2021
2 parents 179923d + 0fc8e26 commit a34024d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tensorflow/python/kernel_tests/unique_op_test.py
Expand Up @@ -282,7 +282,9 @@ def testFloat(self):
tf_y, tf_idx, tf_count = self.evaluate([y, idx, count])

self.assertEqual(len(x), len(tf_idx))
self.assertEqual(len(tf_y), len(np.unique(x)))
# TODO(b/202197513): numpy>=1.20.0 makes np.unique() treat np.nan as equal
# so len(np.unique(x)) == 3. So this no longer can be tested this way.
# self.assertEqual(len(tf_y), len(np.unique(x)))
for i in range(len(x)):
if np.isnan(x[i]):
self.assertTrue(np.isnan(tf_y[tf_idx[i]]))
Expand Down

0 comments on commit a34024d

Please sign in to comment.