diff options
author | 2017-11-13 13:07:45 -0800 | |
---|---|---|
committer | 2017-11-13 13:11:13 -0800 | |
commit | bac56b37be7736c9da9a3257696a9c1241327d60 (patch) | |
tree | 767a1449473fa471aa11d750ac666085494bf00b /tensorflow/core/graph/graph_test.cc | |
parent | 90222dd7b29ff2597bc7f8d0f92db17324f591b0 (diff) |
Validate shapes when updating edges from Python.
Uses MergeInput from shape_inference to check if the new input is compatible with the preexisting shape. Also this changes the MergeInput method. Previously, MergeInput would only return true if the shapes differed *and* the merge was successful. Now, MergeInput returns true only if the merge is successful.
PiperOrigin-RevId: 175576173
Diffstat (limited to 'tensorflow/core/graph/graph_test.cc')
-rw-r--r-- | tensorflow/core/graph/graph_test.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tensorflow/core/graph/graph_test.cc b/tensorflow/core/graph/graph_test.cc index e5d57facaa..7686cef219 100644 --- a/tensorflow/core/graph/graph_test.cc +++ b/tensorflow/core/graph/graph_test.cc @@ -511,6 +511,13 @@ TEST_F(GraphTest, UpdateEdge) { EXPECT_EQ( s.error_message(), "Node 'A' (type: 'OneOutput', num of outputs: 1) does not have output 1"); + + // Update a's 1st input which is out of range. + s = graph_.UpdateEdge(c, 0, a, 0); + EXPECT_FALSE(s.ok()); + EXPECT_EQ( + s.error_message(), + "Node 'A' (type: 'OneOutput', num of inputs: 0) does not have input 0"); } TEST_F(GraphTest, InputEdges) { |