| 593 | } // namespace |
| 594 | |
| 595 | Status Graph::UpdateEdge(Node* new_src, int new_src_index, Node* dst, |
| 596 | int dst_index) { |
| 597 | TF_RETURN_IF_ERROR(IsValidOutputTensor(new_src, new_src_index)); |
| 598 | TF_RETURN_IF_ERROR(IsValidInputTensor(dst, dst_index)); |
| 599 | const Edge* e = FindEdge(dst, dst_index); |
| 600 | if (e == nullptr) { |
| 601 | return errors::InvalidArgument("Couldn't find edge to ", |
| 602 | FormatNodeForError(*dst)); |
| 603 | } |
| 604 | RemoveEdge(e); |
| 605 | AddEdge(new_src, new_src_index, dst, dst_index); |
| 606 | dst->MaybeCopyOnWrite(); |
| 607 | (*dst->props_->node_def.mutable_input())[dst_index] = |
| 608 | strings::StrCat(new_src->name(), ":", new_src_index); |
| 609 | return Status::OK(); |
| 610 | } |
| 611 | |
| 612 | Status Graph::AddWhileInputHack(Node* new_src, int new_src_index, Node* dst) { |
| 613 | if (!dst->IsWhileNode()) { |