szagoruyko / pytorchviz

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

Allow HTML formatting of labels #51

Open joseppinilla opened 3 years ago

joseppinilla commented 3 years ago

This is a very small change that would allow the full use of the graphviz HTML formatting for each node label. I'm not quite sure if this breaks something else, or if these results could be obtained in another way, but this is how it would work. Let's say I want to use subscripts for weight matrices w1 and w2:

make_dot(loss,params={'w<sub>1</sub>':w1,'w<sub>2</sub>':w2})

graphviz example

I had to add double space (i.e. <br/><br/>) otherwise the lines would overlap.