Skip to content

Commit 8590a43

Browse files
committed
Pull request pytorch#34: Add shapes and types to links in ExportedProgram visualization
Merge in AITEC/executorch from feature/nxf93343/program-vizualizer-add-shapes-and-types to main-nxp * commit '1833e0349b9a62e382b42911f8a6ced167eaa984': Add shapes and types to link in ExportedProgram visualization
2 parents 1e1f103 + 1833e03 commit 8590a43

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

backends/nxp/tests/exported_program_vizualize.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,16 @@ def name_color(string): # pseudo-randomization function
6161
# Add connections between nodes
6262
for node in exported_program.graph.nodes:
6363
for user in node.users:
64-
graph.newLink(graph_items[node.name], graph_items[user.name])
64+
link = graph.newLink(graph_items[node.name], graph_items[user.name])
65+
66+
label = ""
67+
if "val" in node.meta:
68+
tensor = node.meta["val"]
69+
if isinstance(tensor, tuple):
70+
tensor = tensor[0] # Fake tensor
71+
label = f" ({list(tensor.shape)} | {tensor.dtype})"
72+
73+
graph.propertyAppend(link, "label", label)
6574

6675
with open("graph.dot", "w") as f:
6776
graph.dot(f)

0 commit comments

Comments
 (0)