You didn’t define any modules in your PyTorch code, so it shouldn’t be executable (or you didn’t post this code snippet).
Also, in Keras you are using two LSTM layers and pass the output of the first one to the second, while you are only using one in PyTorch, so you might want to add the second one.