The code above assumes that the input to self.i2h takes in both the input and the output from the last hidden layer. Similarly, self.i2o takes in both the input and the output from the last hidden layer.
While the code above will still work. I prefer what you mentioned below. In theory, i2o should not be dependent on the input, instead, it should depend on just the output of the current hidden.



 Gideon:

Are there any errors in Line 13th? I mean that ‘combined’ should be replaced by ‘hidden’?
Correspondingly, does the Line 8th should be changed to ’self.h2o = nn.Linear(hidden_size, output_size)‘?