title: How to generate the architectural figure of the network in pytorch when the type of the output of the network is list?
body: <p>I wonder how to use tochviz to generate network architecture, when the output is a list type?
  the demo code is as follows:</p>
  <pre class="lang-py prettyprint-override"><code> import torch
   import torch.nn as nn
   class ConvNet(nn.Module):
       def __init__(self):
           super(ConvNet, self).__init__()
           self.conv1 = nn.Sequential(
               nn.Conv2d(1, 16, 3, 1, 1),
               nn.ReLU(),
               nn.AvgPool2d(2, 2)
           )
           self.conv2 = nn.Sequential(
               nn.Conv2d(16, 32, 3, 1, 1),
               nn.ReLU(),
               nn.MaxPool2d(2, 2)
           )
           self.fc = nn.Sequential(
               nn.Linear(32 * 7 * 7, 128),
               nn.ReLU(),
               nn.Linear(128, 64),
               nn.ReLU()
           )
           self.out = nn.Linear(64, 10)
       def forward(self, x):
           x = self.conv1(x)
           x = self.conv2(x)
           x = x.view(x.size(0), -1)
           x = self.fc(x)
           output = []
           output.append(x)
           output.append(self.out(x))
           return output
   MyConvNet = ConvNet()
  </code></pre>
  <p>and I use <code>torchviz</code> to view this network's architecture like</p>
  <pre class="lang-py prettyprint-override"><code> from torchviz import make_dot
   x = torch.randn(1, 1, 28, 28).requires_grad_(True)
   y = MyConvNet(x)   
   MyConvNetVis = make_dot(y, params=dict(list(MyConvNet.named_parameters()) + [('x', x)]))
   MyConvNetVis.format = &quot;png&quot;
   MyConvNetVis.directory = &quot;data&quot;
   MyConvNetVis.view()
  </code></pre>
  <p>then, I was blocked with this problem</p>
  <pre><code>AttributeError                            Traceback (most recent call last)
  &lt;ipython-input-23-c8e3cd3a8b4e&gt; in &lt;module&gt;
        2 x = torch.randn(1, 1, 28, 28).requires_grad_(True)
        3 y = MyConvNet(x)
  ----&gt; 4 MyConvNetVis = make_dot(y, params=dict(list(MyConvNet.named_parameters()) + [('x', x)]))
        5 MyConvNetVis.format = &quot;png&quot;
        6 MyConvNetVis.directory = &quot;data&quot;
  
  ~/anaconda3/envs/torch1.3/lib/python3.6/site-packages/torchviz/dot.py in make_dot(var, params)
       35         return '(' + (', ').join(['%d' % v for v in size]) + ')'
       36 
  ---&gt; 37     output_nodes = (var.grad_fn,) if not isinstance(var, tuple) else tuple(v.grad_fn for v in var)
       38 
       39     def add_nodes(var):
  
  AttributeError: 'list' object has no attribute 'grad_fn'
  
  </code></pre>
  <p>Any advice will be appreciated.</p>