(self, forward_debug_infos: list)
| 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) |
no test coverage detected