pytorch 网络结构可视化

http://blog.csdn.net/gyguo95/article/details/78821617

???可以不加这一行? conda install python-graphviz
sudo apt-get install graphviz
pip install git+https://github.com/szagoruyko/pytorchviz

import torch
from torch.autograd import Variable

from MyNet import MyNet
from visualize import  make_dot

x = Variable(torch.randn(1,22,224,224))#change 12 to the channel number of network input
model = MyNet()
y = model(x)
g = make_dot(y)
g.view()

如果遇到问题:
RuntimeError: failed to execute [‘dot’, ‘-Tpdf’, ‘-O’, ‘Digraph.gv’], make sure the Graphviz executables are on your systems’ path
解决方案:sudo apt-get install graphviz

你可能感兴趣的:(pytorch)