LSTMCell
is more flexible and you need less code with LSTM
.
So with LSTMCell
,
def forward(self, x):
h = self.get_hidden()
for input in x:
h = self.rnn(input, h) # self.rnn = self.LSTMCell(input_size, hidden_size)
while with LSTM
it is
def forward(self, x):
h_0 = self.get_hidden()
output, h = self.rnn(x, h_0) # self.rnn = self.LSTM(input_size, hidden_size)
output
is the blue rectangles in your fig.