title: Add a layer to model state dictionary in PyTorch
body: <p>I have a neural network in PyTorch like,</p>
  <pre><code>class Net1(nn.Module):
      
      def __init__(self):
          super(Net, self).__init__()
          
          self.conv_g = ResBlock(2,81)
          self.conv_low1 = ResBlock(2,90)
          self.conv_low2 = ResBlock(2,90)
          self.conv_low3 = ResBlock(2,90)
          self.conv_low4 = ResBlock(2,90)
          self.conv_low5 = ResBlock(2,90)
          self.conv_low6 = ResBlock(2,90)
          self.conv_low7 = ResBlock(2,90)
          self.conv_low8 = ResBlock(2,90)
          self.conv_low9 = ResBlock(2,90)
          
          self.stagIII = stageIII()
          
      def forward(self,x):
          ...
          
          return out
  </code></pre>
  <p>To this network I have added a new layer <code>m</code> whose weights <em><strong>I know</strong></em>.</p>
  <pre><code>class Net2(nn.Module):
      
      def __init__(self):
          super(Net, self).__init__()
  
          self.m = nn.Linear(5,1)
          
          self.conv_g = ResBlock(2,81)
          self.conv_low1 = ResBlock(2,90)
          self.conv_low2 = ResBlock(2,90)
          self.conv_low3 = ResBlock(2,90)
          self.conv_low4 = ResBlock(2,90)
          self.conv_low5 = ResBlock(2,90)
          self.conv_low6 = ResBlock(2,90)
          self.conv_low7 = ResBlock(2,90)
          self.conv_low8 = ResBlock(2,90)
          self.conv_low9 = ResBlock(2,90)
          
          self.stagIII = stageIII()
          
      def forward(self,x):
          ...
          
          return out
  </code></pre>
  <p>The state dictionary of <code>m.state_dict()</code> is</p>
  <pre><code>OrderedDict([('weight', tensor([[ 1.0000,  2.0000,  3.0000,  4.0000, 5.0000]])), ('bias', tensor([0.]))])
  </code></pre>
  <p>Now given that I have <code>Net1.state_dict()</code> and <code>m.state_dict()</code>, how can I append <code>m</code> dictionary to <code>Net1</code> dictionary to obtain state dictionary of <code>Net2</code>?</p>