Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #70 from mlcommons/et-visualizer-fix
Browse files Browse the repository at this point in the history
[chakra][et_visualizer] Use the latest schema
  • Loading branch information
srinivas212 committed Dec 6, 2023
2 parents fb845ee + 64667e5 commit ac2fb60
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion et_visualizer/et_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
openFileRd as open_file_rd,
decodeMessage as decode_message
)
from chakra.et_def.et_def_pb2 import Node
from chakra.et_def.et_def_pb2 import (
GlobalMetadata,
Node,
)


def main() -> None:
Expand All @@ -33,10 +36,12 @@ def main() -> None:

et = open_file_rd(args.input_filename)
node = Node()
gm = GlobalMetadata()

# Determine the file type to be created based on the output filename
if args.output_filename.endswith((".pdf", ".dot")):
f = graphviz.Digraph()
decode_message(et, gm)
while decode_message(et, node):
f.node(name=f"{node.id}",
label=f"{node.name}",
Expand All @@ -59,6 +64,7 @@ def main() -> None:
format="dot", cleanup=True)
elif args.output_filename.endswith(".graphml"):
G = nx.DiGraph()
decode_message(et, gm)
while decode_message(et, node):
G.add_node(node.id, label=node.name)

Expand Down

0 comments on commit ac2fb60

Please sign in to comment.