| 24 | namespace tensorflow { |
| 25 | |
| 26 | Status BackEdgeHelper::Remove(Graph* graph) { |
| 27 | if (graph_ != nullptr) { |
| 28 | return errors::Internal("BackEdgeHelper duplicate call to Remove."); |
| 29 | } |
| 30 | graph_ = graph; |
| 31 | for (Node* n : graph_->nodes()) { |
| 32 | if (n->IsMerge()) { |
| 33 | for (const Edge* e : n->in_edges()) { |
| 34 | if (e->src()->IsNextIteration()) { |
| 35 | back_edges_.push_back( |
| 36 | BackEdge{e, e->src(), e->src_output(), e->dst(), e->dst_input()}); |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | for (const BackEdge& be : back_edges_) { |
| 42 | graph_->RemoveEdge(be.edge); |
| 43 | } |
| 44 | return Status::OK(); |
| 45 | } |
| 46 | |
| 47 | const std::vector<BackEdgeHelper::BackEdge>& BackEdgeHelper::RemovedEdges() |
| 48 | const { |
no test coverage detected