| 1026 | } |
| 1027 | |
| 1028 | Status GraphPartitionerBase::CompleteSubGraphV2( |
| 1029 | SubGraph &sub_graph, int graph_idx, |
| 1030 | std::unordered_map<const Node*, int> &node_to_subgraph_id) { |
| 1031 | const std::string &loc = sub_graph.GetLoc(); |
| 1032 | GraphDef &graph_def = sub_graph.GetGraphDef(); |
| 1033 | NodeDef* new_fuse_recv_node = nullptr; |
| 1034 | std::unordered_map<std::string, int> src_to_slot; |
| 1035 | bool use_fuse_recv = UseFuseRecvV2(sub_graph, graph_idx, |
| 1036 | &new_fuse_recv_node, |
| 1037 | src_to_slot); |
| 1038 | std::map<InputSrcKey, NodeDef*> input_src_nodes_map; |
| 1039 | std::map<InputSrcKey, NodeDef*> local_input_map; |
| 1040 | std::map<InputSrcKey, NodeDef*> local_ref_input_map; |
| 1041 | for (const Node* node: sub_graph.GetNodes()) { |
| 1042 | NodeDef *node_def = graph_def.add_node(); |
| 1043 | Status s = ConstructNodeDef(node, node_def); |
| 1044 | RETURN_IF_NOT_OK(s); |
| 1045 | |
| 1046 | std::vector<std::pair<std::string, const Edge*>> boundary_input_edges; |
| 1047 | if (use_fuse_recv) { |
| 1048 | s = ProcessSubNodeInputsV2(node, loc, node_def, |
| 1049 | &graph_def, &input_src_nodes_map, |
| 1050 | &local_input_map, |
| 1051 | &local_ref_input_map, |
| 1052 | &boundary_input_edges, |
| 1053 | new_fuse_recv_node, |
| 1054 | src_to_slot, sub_graph, |
| 1055 | node_to_subgraph_id); |
| 1056 | } else { |
| 1057 | s = ProcessSubNodeInputsV2(node, loc, node_def, |
| 1058 | &graph_def, &input_src_nodes_map, |
| 1059 | &local_input_map, |
| 1060 | &local_ref_input_map, |
| 1061 | &boundary_input_edges, |
| 1062 | sub_graph, |
| 1063 | node_to_subgraph_id); |
| 1064 | } |
| 1065 | RETURN_IF_NOT_OK(s); |
| 1066 | |
| 1067 | sub_graph.AddInputs(boundary_input_edges); |
| 1068 | |
| 1069 | std::vector<std::pair<std::string, const Edge*>> boundary_output_edges; |
| 1070 | s = ProcessSubNodeOutputsV2(node, loc, node_def, &graph_def, |
| 1071 | &boundary_output_edges, |
| 1072 | sub_graph, |
| 1073 | node_to_subgraph_id); |
| 1074 | RETURN_IF_NOT_OK(s); |
| 1075 | |
| 1076 | sub_graph.AddOutputs(boundary_output_edges); |
| 1077 | } |
| 1078 | |
| 1079 | return Status::OK(); |
| 1080 | } |
| 1081 | |
| 1082 | Status GraphPartitionerBase::CompleteSubGraphsV2( |
| 1083 | std::vector<SubGraph> *sub_graphs) { |
nothing calls this directly
no test coverage detected