There are a few things where Keras has defaults that are different to PyTorch’s that you would want to aware of. Using the forum search function with Keras LSTM, you will find a number of threads on the subject, including the one below that might be a good starting point.
Best regards
Thomas

  
    
    
    I'm stuck in converting Keras LSTM to Pytorch. Especially in Data Type 
  
  
    I’m trying to model converting from Keras to Pytorch. 
I think the problem is to train model part code. 
So, can anyone help this part for me. 
I’m newb at Pytorch… 
This is a Keras model configuration. 
The objective of this model is many to one model for prediction. 
The data ( [ a1 a2 a3 a4 a5] ) is fed into this model. And model predict a6. 
    model = Sequential()
    model.add(LSTM(10, return_sequences=True, input_shape=(windowsize,1)))
    model.add(LSTM(10))
    model.add(Dense(outputsi…