I modified the code a bit and tried to run it on CPU, The code and the stack trace is as follows:

Training Run
for epoch in range(1, n_epochs + 1):
optimizer.zero_grad() # Clears existing gradients from previous epoch
Train_tensor = Train_tensor.float()
output, hidden = model(Train_tensor)
Traintgt_tensor= Traintgt_tensor.float()
loss = criterion(output, Traintgt_tensor.view(-1,1))
loss.backward() # Does backpropagation and calculates gradients
optimizer.step() # Updates the weights accordingly
  if epoch%10 == 0:
        print('Epoch: {}/{}.............'.format(epoch, n_epochs), end=' ')
        print("Loss: {:.4f}".format(loss.item()))



Error:
Hidden torch.Size([1, 702, 500])
Output torch.Size([702, 121, 500])
Linear layer torch.Size([84942, 1])
RuntimeError                              Traceback (most recent call last)
 in ()
9     #Traintgt_tensor = Traintgt_tensor.to(device)
10     Traintgt_tensor= Traintgt_tensor.float()
—> 11     loss = criterion(output, Traintgt_tensor.view(-1,1))
12     #loss = criterion(output, trialtgt)
13     loss.backward() # Does backpropagation and calculates gradients
~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
530             result = self._slow_forward(*input, **kwargs)
531         else:
–> 532             result = self.forward(*input, **kwargs)
533         for hook in self._forward_hooks.values():
534             hook_result = hook(self, input, result)
~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/loss.py in forward(self, input, target)
914     def forward(self, input, target):
915         return F.cross_entropy(input, target, weight=self.weight,
–> 916                                ignore_index=self.ignore_index, reduction=self.reduction)
917
918
~/anaconda3/lib/python3.6/site-packages/torch/nn/functional.py in cross_entropy(input, target, weight, size_average, ignore_index, reduce, reduction)
2019     if size_average is not None or reduce is not None:
2020         reduction = _Reduction.legacy_get_string(size_average, reduce)
-> 2021     return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, reduction)
2022
2023
~/anaconda3/lib/python3.6/site-packages/torch/nn/functional.py in nll_loss(input, target, weight, size_average, ignore_index, reduce, reduction)
1836                          .format(input.size(0), target.size(0)))
1837     if dim == 2:
-> 1838         ret = torch._C._nn.nll_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
1839     elif dim == 4:
1840         ret = torch._C._nn.nll_loss2d(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
RuntimeError: 1D target tensor expected, multi-target not supported