title: Reset parameters of a neural network in pytorch
body: <p>I have a neural network with the following structure:</p>
  <pre><code>class myNetwork(nn.Module):
      def __init__(self):
          super(myNetwork, self).__init__()
          self.bigru = nn.GRU(input_size=2, hidden_size=100, batch_first=True, bidirectional=True)
          self.fc1 = nn.Linear(200, 32)
          torch.nn.init.xavier_uniform_(self.fc1.weight)
          self.fc2 = nn.Linear(32, 2)
          torch.nn.init.xavier_uniform_(self.fc2.weight)
  </code></pre>
  <p>I need to reinstate the model to an unlearned state by resetting the parameters of the neural network. I can do so for <code>nn.Linear</code> layers by using the method below:</p>
  <pre><code>def reset_weights(self):
      torch.nn.init.xavier_uniform_(self.fc1.weight)
      torch.nn.init.xavier_uniform_(self.fc2.weight)
  </code></pre>
  <p>But, to reset the weight of the <code>nn.GRU</code> layer, I could not find any such snippet.</p>
  <p>My question is how does one reset the <code>nn.GRU</code> layer? Any other way of resetting the network is also fine. Any help is appreciated.</p>