Hi, I think that there is an error in the example presented for a LSTMCell:
https://pytorch.org/docs/stable/generated/torch.nn.LSTMCell.html: 10
Screenshot from 2021-02-04 16-32-031044×345 21.3 KB
The loop iterates over 6 steps, but the input has only 3 steps.  I also think that there is an error with the shape of the initial hidden and cell states. Here is my suggestion:
rnn = nn.LSTMCell(10, 20)
input = torch.randn(3, 10)
hx = torch.randn(1, 20)
cx = torch.randn(1, 20)
output = []
for i in range(input.size()[0]):
hx, cx = rnn(input[i:i+1], (hx, cx))
output.append(hx)
Please let me know if I misunderstood something