Convert eras to pytorch

I am trying to implement machine translation using pytorch but without torch text i.e. without bucketiterator etc.
from keras.layers import Input, LSTM, Embedding, Dense
from keras.models import Model

encoder_inputs = Input(shape=(None,))
enc_emb = Embedding(num_encoder_tokens, latent_dim, mask_zero = True)(encoder_inputs)
encoder_lstm = LSTM(latent_dim, return_state=True)
encoder_outputs, state_h, state_c = encoder_lstm(enc_emb)

We discard encoder_outputs and only keep the states.

encoder_states = [state_h, state_c]

I am trying to code in pytorch
encoder_input = torch.randn(1,None,)
enc_emb = nn.Embedding(num_encoder_tokens, latent_dim)
but I am not able to convert it
keras code is from English to Hindi Neural Machine Translation | Kaggle
Any one help me how to implement it in pytorch