In order to understand the internal structure of RNN, I reproduced RNN according to the input format of nn.RNN, and can view the structure in tensorboardX. The link is :

  
      
      GitHub
  
  
    

VeritasXu/RNN 15

pytorch user defined RNN


  
  
    
    
  
  


(pytorch0.3.1+tensorboardX)
In my github, RNNs.py and RNNs_2.py are difficult at forward , RNNs use a during forward, and RNNs_2 use a[t] instead.
My problem is that which of the 2 is the correct one ?  If both of them are incorrect, how to correct them?
What’s more, in RNNs_2.py，I originally wanted to use 3D matrix to represent variable hidden in forward but failed.
Hope for your help!