Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/ngraph_capture_variables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,16 @@ Status CaptureVariables(Graph* graph, const std::set<string> skip_these_nodes) {
NGRAPH_VLOG(4) << "Replacing Node " << node->DebugString() << " with "
<< replacement->DebugString();

// Though edges will be removed when we remove the node
// we specifically remove the edges to be sure
std::vector<const Edge*> edges_to_remove;
for (auto edge : node->in_edges()) {
NGRAPH_VLOG(4) << "Replacing: " << edge->DebugString();
graph->AddEdge(edge->src(), edge->src_output(), replacement,
edge->dst_input());
edges_to_remove.push_back(edge);
}
// Though edges will be removed when we remove the node
// we specifically remove the edges to be sure
for (auto edge : edges_to_remove) {
graph->RemoveEdge(edge);
}

Expand Down