Computational graph to image

I’ve read a lot of posts about graph visualization in pytorch, but i still can’t find something really usable.

I’ve tried with https://github.com/szagoruyko/functional-zoo/blob/master/visualize.py but graphviz’s image conversion seems too heavy if we have a large model (i.e. resnet34) and my process goes on for hours if i try to save a png or any image format.

I’ve also read about the tensorboard integration, but i use visdom and would like to stick with it.

So are there any new ways to get the pytorch computational graph and get an image from it?

My final goal is to send the image to visdom in order to visualize it with all my other logs.

1 Like

Hi,

One way to go if you have a “classic” network is to export it with onnx and then use tools that can be used for caffe2 or tensorflow models.
The problem with exporting directly from pytorch is that you will usually have a graph with very low level operations which makes it (very) big.

I tried to export my model with onnx since i saw that caffe2 has a simple way to create graph’s png, but i get the following error

RuntimeError: torch/csrc/autograd/functions/onnx/convolution.cpp:61: symbolic: output padding is not supported.

I guess i can’t export my model because it includes transposed convolutions with output padding and they’re not supported yet. Is there any way around this?

Unfortunately no as this would require to add this specific function to onnx. I am not sure how easy/hard that would be as this might depend on the other framework’s (caffe2 here) capacity to do the exact same operation.

you can try this :slight_smile:

2 Likes

If rendering speed is your main issue, you can export to SVG which creates much smaller files which gets rendered in real time by your viewer (for example, your browser).