How to visualize the computing graph of the mlx models? #888
-
How to visualize the computing graph of the mlx models? Is there a tool like tensorboard for mlx? |
Beta Was this translation helpful? Give feedback.
Answered by
angeloskath
Mar 24, 2024
Replies: 1 comment
-
For any array one can export the computation graph to There are a couple of things to pay attention to:
Here is an example with the corresponding png generated: import mlx.core as mx
x = mx.random.normal(shape=(10, 10))
y = mx.random.normal(shape=(10, 10))
mx.eval(x, y) # <--- important in order to not have the x, y initialization in the graph
z = ((x @ y).square() + 1).sum()
mx.export_to_dot("/tmp/example.dot", z) then running |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
awni
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For any array one can export the computation graph to
.dot
format usingmx.export_to_dot("filename.dot", x, y, z)
. Then the dot file can be made into a png or pdf using thedot
command line tool. My goto isdot -Tpng filename.dot -o filename.png
.There are a couple of things to pay attention to: