Skip to content

Commit

Permalink
Quick temporary fix to nightlies breakage due to np.array() nesting c…
Browse files Browse the repository at this point in the history
…hanges.

https://numpy.org/doc/stable/release/1.20.0-notes.html#array-coercion-restructure

PiperOrigin-RevId: 401568286
Change-Id: I4b8591cfce57708131bab37a9eda99ac54e0ad33
  • Loading branch information
aselle authored and tensorflower-gardener committed Oct 7, 2021
1 parent bcabda0 commit f0aa81e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tensorflow/python/framework/test_util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,19 @@ def testAllCloseTensors(self):
b_dict = {"key": b}
self.assertAllClose(a_dict, b_dict)

x_list = [a, b]
y_list = [a_raw_data, b]
self.assertAllClose(x_list, y_list)
# Disable this subtest until we debug the new np.array() coercion behavior
# https://numpy.org/doc/stable/release/1.20.0-notes.html#array-coercion-restructure
# x_list is of the form [Op1, Op2] in np<1.20 this works fine, but in
# >=1.20 it behaves like np.array([np.array(Op1), np.array(op2)]) which
# doesn't work in either 1.19 or 1.20.
# TODO(b/202303409): Disable the gate once we fix assertAllClose or fix
# a deeper issue with conversion.
versions = np.version.version.split(".")
major, minor = int(versions[0]), int(versions[1])
if major == 1 and minor < 20:
x_list = [a, b]
y_list = [a_raw_data, b]
self.assertAllClose(x_list, y_list)

@test_util.run_in_graph_and_eager_modes
def testAllCloseScalars(self):
Expand Down

0 comments on commit f0aa81e

Please sign in to comment.