(
node: torch.fx.Node, graph_module: torch.fx.GraphModule | None = None
)
| 21 | |
| 22 | |
| 23 | def get_node_debug_info( |
| 24 | node: torch.fx.Node, graph_module: torch.fx.GraphModule | None = None |
| 25 | ) -> str: |
| 26 | output = ( |
| 27 | f" {inspect_node(graph=graph_module.graph, node=node)}\n" |
| 28 | if graph_module |
| 29 | else "" |
| 30 | "-- NODE DEBUG INFO --\n" |
| 31 | f" Op is {node.op}\n" |
| 32 | f" Name is {node.name}\n" |
| 33 | f" Node target is {node.target}\n" |
| 34 | f" Node args is {node.args}\n" |
| 35 | f" Node kwargs is {node.kwargs}\n" |
| 36 | f" Node users is {node.users}\n" |
| 37 | " Node.meta = \n" |
| 38 | ) |
| 39 | for k, v in node.meta.items(): |
| 40 | if k == "stack_trace": |
| 41 | matches = v.split("\n") |
| 42 | output += " 'stack_trace =\n" |
| 43 | for m in matches: |
| 44 | output += f" {m}\n" |
| 45 | else: |
| 46 | output += f" '{k}' = {v}\n" |
| 47 | |
| 48 | if isinstance(v, list): |
| 49 | for i in v: |
| 50 | output += f" {i}\n" |
| 51 | return output |
| 52 | |
| 53 | |
| 54 | # Output TOSA flatbuffer for debugging |
no test coverage detected