szagoruyko / pytorchviz

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

How does one save the image as a file? #39

Closed brando90 closed 4 years ago

brando90 commented 4 years ago

How does one save the image as a file?

brando90 commented 4 years ago
# http://www.bnikolic.co.uk/blog/pytorch-detach.html

import torch
from torchviz import make_dot

x=torch.ones(10, requires_grad=True)
weights = {'x':x}

y=x**2
z=x**3
r=(y+z).sum()

make_dot(r).render("attached", format="png")
brando90 commented 4 years ago

https://stackoverflow.com/a/60253769/1601580

Code-Cornelius commented 2 years ago

https://github.com/szagoruyko/pytorchviz/issues/24 seems like of more help.