MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / build_graph

Method build_graph

python/paddle/utils/fwd_graph_utils.py:204–224  ·  view source on GitHub ↗
(self, forward_debug_infos: list)

Source from the content-addressed store, hash-verified

202 self.graph = Graph()
203
204 def build_graph(self, forward_debug_infos: list):
205 for info in forward_debug_infos:
206 debug_info = parse_debug_info(info)
207 api_name = debug_info['API_Name']
208 # Add a node for the API
209 self.graph.add_node(api_name)
210 # Store the Edge
211 for out_param in debug_info["Output"]:
212 var_name = out_param[0]
213 tensors = out_param[1]
214 for tensor_info in tensors:
215 # When we do not know the edge's dst, we should store it to the Graph
216 edge = Edge(tensor_info, api_name)
217 self.graph.store_edge(edge)
218 # Link the Edge
219 for input_param in debug_info["Input"]:
220 var_name = input_param[0]
221 tensors = input_param[1]
222 for tensor_info in tensors:
223 edge = Edge(tensor_info)
224 self.graph.add_edge(dst=api_name, edge=edge)
225
226 def save_graph(self, file_path):
227 self.graph.render(file_path)

Callers 1

Calls 5

parse_debug_infoFunction · 0.85
store_edgeMethod · 0.80
EdgeClass · 0.70
add_nodeMethod · 0.45
add_edgeMethod · 0.45

Tested by

no test coverage detected