Skip to content

How to visualize the computing graph of the mlx models? #888

Answered by angeloskath
0x1orz asked this question in Q&A
Discussion options

You must be logged in to vote

For any array one can export the computation graph to .dot format using mx.export_to_dot("filename.dot", x, y, z). Then the dot file can be made into a png or pdf using the dot command line tool. My goto is dot -Tpng filename.dot -o filename.png.

There are a couple of things to pay attention to:

  • This API is kind of an internal one that we sometimes use for debugging. I don't think it is going anywhere any time soon but your mileage may vary.
  • Evaluated arrays almost always have no computation graph. So you should call export to dot before calling eval.
  • The graph is the whole graph. Not with respect to the input to the model. For instance if the weights have not been evaluated then the gra…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by awni
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants