szagoruyko / pytorchviz

A small package to create visualizations of PyTorch execution graphs
MIT License
3.24k stars 279 forks source link

Must it be running in jupyter notebook? #3

Closed jxgu1016 closed 6 years ago

jxgu1016 commented 6 years ago

Or any way to export the graph to image files?

adrianjav commented 6 years ago

You can do

output = model(input)
dot = make_dot(output, params=dict(model.named_parameters()))
dot.format = 'svg'
dot.render()

to export it as a svg file in your working directory.

And if you want to know more I recommend you checking this out.

kaushikacharya commented 1 year ago

And if you want to know more I recommend you checking this out.

To understand why graph is rendered and displayed directly one can have a look at Jupyter Notebook section of graphviz's manual.