MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / AddOutputEdges

Method AddOutputEdges

tensorflow/compiler/tf2xla/functionalize_cond.cc:849–886  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

847}
848
849Status Conditional::AddOutputEdges(
850 Graph* graph,
851 std::unordered_map<Node*, OutputTensor>* merge_to_replacement) {
852 VLOG(2) << "AddOutputEdges for " << if_node_->name();
853 int i = 0;
854 for (Node* node : merges_) {
855 TF_RETURN_IF_ERROR(parent_->AddIdentityNode(node, if_node_, i));
856 std::vector<const Edge*> edges(node->out_edges().begin(),
857 node->out_edges().end());
858 for (const Edge* edge : edges) {
859 Node* dst = edge->dst();
860 int dst_input = edge->dst_input();
861 if (edge->src_output() > 0) {
862 return errors::Unimplemented("Output of index (", edge->src_output(),
863 ") of merge node ",
864 FormatNodeForError(*node));
865 }
866
867 bool control_edge = edge->IsControlEdge();
868 graph->RemoveEdge(edge);
869 if (control_edge) {
870 graph->AddControlEdge(if_node_, dst);
871 } else {
872 graph->AddEdge(if_node_, i, dst, dst_input);
873 }
874 }
875
876 // Record corresponding output tensor in 'merge_to_replacement'.
877 (*merge_to_replacement)[node] = OutputTensor{if_node_, i};
878
879 ++i;
880 }
881 for (Node* n : external_control_outputs_) {
882 graph->AddControlEdge(if_node_, n);
883 }
884
885 return Status::OK();
886}
887
888Status Conditional::BuildAndReplace(
889 Graph* graph, FunctionLibraryDefinition* library,

Callers

nothing calls this directly

Calls 13

UnimplementedFunction · 0.85
FormatNodeForErrorFunction · 0.85
AddIdentityNodeMethod · 0.80
nameMethod · 0.65
beginMethod · 0.45
endMethod · 0.45
dstMethod · 0.45
dst_inputMethod · 0.45
src_outputMethod · 0.45
IsControlEdgeMethod · 0.45
RemoveEdgeMethod · 0.45
AddControlEdgeMethod · 0.45

Tested by

no test coverage detected