diff options
author | Benoit Steiner <bsteiner@google.com> | 2017-06-29 16:30:42 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-06-29 16:34:56 -0700 |
commit | 4eb71a7f1aa01639a57b67413e7225fc26512ead (patch) | |
tree | 15e197ef4f570fb13c93fa4bbbe6185cb862f6c0 /tensorflow/core/graph/graph.cc | |
parent | 034236aa27ae5e40a6fe619d43c94fb01f529601 (diff) |
Don't crash when converting ill formed graphs to graph defs: this can happen
with legacy fed inputs whose 2 inputs may remain unconnected.
PiperOrigin-RevId: 160589677
Diffstat (limited to 'tensorflow/core/graph/graph.cc')
-rw-r--r-- | tensorflow/core/graph/graph.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tensorflow/core/graph/graph.cc b/tensorflow/core/graph/graph.cc index 9469e3f98f..7a5e76fdd0 100644 --- a/tensorflow/core/graph/graph.cc +++ b/tensorflow/core/graph/graph.cc @@ -502,7 +502,11 @@ void Graph::ToGraphDefSubRange(GraphDef* graph_def, int from_node_id) const { for (size_t i = 0; i < inputs.size(); ++i) { const Edge* edge = inputs[i]; if (edge == nullptr) { - node_def->add_input(node->requested_inputs()[i]); + if (i < node->requested_inputs().size()) { + node_def->add_input(node->requested_inputs()[i]); + } else { + node_def->add_input(""); + } } else { const Node* src = edge->src(); if (!src->IsOp()) continue; |