| 610 | } |
| 611 | |
| 612 | Status Graph::AddWhileInputHack(Node* new_src, int new_src_index, Node* dst) { |
| 613 | if (!dst->IsWhileNode()) { |
| 614 | return errors::Internal( |
| 615 | "dst argument to AddWhileEdgeHack should be a While op, got: ", |
| 616 | dst->DebugString()); |
| 617 | } |
| 618 | TF_RETURN_IF_ERROR(IsValidOutputTensor(new_src, new_src_index)); |
| 619 | // Find the current number of data inputs. We'll add the new edge to the next |
| 620 | // missing data input. |
| 621 | int dst_index = 0; |
| 622 | for (const Edge* edge : dst->in_edges()) { |
| 623 | if (edge->IsControlEdge()) continue; |
| 624 | ++dst_index; |
| 625 | } |
| 626 | TF_RETURN_IF_ERROR(IsValidInputTensor(dst, dst_index)); |
| 627 | AddEdge(new_src, new_src_index, dst, dst_index); |
| 628 | dst->MaybeCopyOnWrite(); |
| 629 | dst->props_->node_def.add_input( |
| 630 | strings::StrCat(new_src->name(), ":", new_src_index)); |
| 631 | return Status::OK(); |
| 632 | } |
| 633 | |
| 634 | Status Graph::AddFunctionLibrary(const FunctionDefLibrary& fdef_lib) { |
| 635 | // Need a new-enough consumer to support the functions we add to the graph. |
no test coverage detected