After applying previous reply embembedded = self.embeddings(x).view(1, 1, -1).I got the error.
 def forward(self, x, hidden, train = True):
        """ predict, return hidden state so it can be used to intialize the next hidden state """
      
        embedded = self.embeddings(x).view(1, 1, -1)
        embedded = self.drop(embedded) if train else embedded
        
        lstm_output, hdn = self.lstm(embedded, hidden)
        reshaped = lstm_output.view(-1, lstm_output.size(2))
        dropped = self.drop(reshaped) if train else reshaped
    
        decoded = self.linear(dropped)
        
        logits = F.log_softmax(decoded, dim = 1)
                
        return logits, self.detach_hidden(hdn)    
    

RuntimeError                              Traceback (most recent call last)
<ipython-input-24-6c5c0b136b8a> in <module>()
      3     model.cuda()
      4 trainer = Trainer(train_iter = train_iter, val_iter = val_iter)
----> 5 trainer.train_model(model = model, num_epochs = 1)

<ipython-input-23-d6fd9f7bb41a> in train_model(self, model, num_epochs)
     45                 optimizer.zero_grad()
     46 
---> 47                 y_pred, hidden = model.forward(x, hidden, train = False)
     48 
     49                 loss = criterion(y_pred, y)

<ipython-input-22-a749ecb174fe> in forward(self, x, hidden, train)
     33         embedded = self.drop(embedded) if train else embedded
     34 
---> 35         lstm_output, hdn = self.lstm(embedded, hidden)
     36         reshaped = lstm_output.view(-1, lstm_output.size(2))
     37         dropped = self.drop(reshaped) if train else reshaped

/home/naditya/anaconda2/lib/python2.7/site-packages/torch/nn/modules/module.pyc in __call__(self, *input, **kwargs)
    489             result = self._slow_forward(*input, **kwargs)
    490         else:
--> 491             result = self.forward(*input, **kwargs)
    492         for hook in self._forward_hooks.values():
    493             hook_result = hook(self, input, result)

/home/naditya/anaconda2/lib/python2.7/site-packages/torch/nn/modules/rnn.pyc in forward(self, input, hx)
    176             flat_weight = None
    177 
--> 178         self.check_forward_args(input, hx, batch_sizes)
    179         func = self._backend.RNN(
    180             self.mode,

/home/naditya/anaconda2/lib/python2.7/site-packages/torch/nn/modules/rnn.pyc in check_forward_args(self, input, hidden, batch_sizes)
    128             raise RuntimeError(
    129                 'input.size(-1) must be equal to input_size. Expected {}, got {}'.format(
--> 130                     self.input_size, input.size(-1)))
    131 
    132         if is_input_packed:

RuntimeError: input.size(-1) must be equal to input_size. Expected 300, got 96000