output, hidden = self.gru(gru_input, hidden)
fc_output = self.fc(hidden[-1]) // Use the last layer
print("Final output size", fc_output.size())
return fc_output
def _init_hidden(self, batch_size):
hidden = torch.zeros(self.n_layers, batch_size, self.hidden_size)
After Change
// input shape: B x S (input size)
// transpose to make S(sequence) x B (batch)
input = input.t()
batch_size = input.size(1)
// Make a hidden
hidden = self._init_hidden(batch_size)