diff options
author | Yifei Feng <yifeif@google.com> | 2017-11-22 13:42:21 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-11-22 13:50:02 -0800 |
commit | b1d8c59e9b014b527fb2fbef9ce9afc14dbc4938 (patch) | |
tree | af207d5a90f3176bdd3fbffbe1e98258125bf389 /tensorflow/core/graph/graph.cc | |
parent | e219aeb542779d90a582ffe16f8602cd1b275b22 (diff) |
Merge changes from github.
PiperOrigin-RevId: 176695926
Diffstat (limited to 'tensorflow/core/graph/graph.cc')
-rw-r--r-- | tensorflow/core/graph/graph.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tensorflow/core/graph/graph.cc b/tensorflow/core/graph/graph.cc index 87c41186d5..fd1b5d33b9 100644 --- a/tensorflow/core/graph/graph.cc +++ b/tensorflow/core/graph/graph.cc @@ -453,6 +453,21 @@ const Edge* Graph::AddControlEdge(Node* source, Node* dest, return AddEdge(source, kControlSlot, dest, kControlSlot); } +void Graph::RemoveControlEdge(const Edge* e) { + if (!e->src_->IsSource() && !e->dst_->IsSink()) { + e->dst_->MaybeCopyOnWrite(); + std::string e_src_name = strings::StrCat("^", e->src_->name()); + auto* inputs = e->dst_->props_->node_def.mutable_input(); + for (auto it = inputs->begin(); it != inputs->end(); ++it) { + if (*it == e_src_name) { + inputs->erase(it); + break; + } + } + } + RemoveEdge(e); +} + Status Graph::UpdateEdge(Node* new_src, int new_src_index, Node* dst, int dst_index) { TF_RETURN_IF_ERROR(IsValidOutputTensor(new_src, new_src_index)); |