gm = torch.fx.symbolic_trace(m)

gm.graph.print_tabular()

I am trying to export the graph for model, is there anyway to convert graph.print_tabular() into dictionary format?

gm = torch.fx.symbolic_trace(m)

gm.graph.print_tabular()

I am trying to export the graph for model, is there anyway to convert graph.print_tabular() into dictionary format?

Something of this kind?

```
graph = {
f"op_{idx}": {
"opcode": n.op,
"name": n.name,
"target": n.target,
"args": n.args,
"kwargs": n.kwargs,
...
} for idx, n in enumerate(gm.graph.nodes)
}
```

Yes, this will work, Thank you so much

You might try something like this as well which is simplier, but I donâ€™t remember by heart what Node.**dict** contains exactly.

```
graph = {f"op_{idx}": n.__dict__ for idx, n in enumerate(gm.graph.nodes)}
```