gtamba:

The pytorch LSTM module seems to have less learnable parameters than the keras LSTM, (About 30k for T=50 timsteps) does this mean the keras LSTM is a larger abstraction of a basic LSTM with additional layers? I do believe the implementations of the LSTM formulae cannot differ by that much.


That’s an interesting finding and I would probably start by comparing this layer in isolation to narrow down where this difference is coming from.



 gtamba:

Do I need to detach certain parts of the LSTM if I am only using the last feature map in the output?


If you are passing the states to the nn.LSTM in PyTorch you could detach them to make sure Autograd won’t backpropagate through the previous time steps. Based on your code you are passing the inputs only to this layer so that the states should be initialized as zeros internally.