Thanks @albanD. your doc 13 saves me from a huge mistake. I was feeding wrong input to embedding layer. But now I received a new error in computing loss:
Traceback (most recent call last):
  File "/home/mahsa/PycharmProjects/PyTorch_env_project/Thesis/proj2/mahsa_rnn_sent_classification.py", line 271, in <module>
    train()
  File "/home/mahsa/PycharmProjects/PyTorch_env_project/Thesis/proj2/mahsa_rnn_sent_classification.py", line 234, in train
    loss = criterion(output, target)
  File "/home/mahsa/anaconda3/envs/pytorch_env/lib/python3.5/site-packages/torch/nn/modules/module.py", line 224, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/mahsa/anaconda3/envs/pytorch_env/lib/python3.5/site-packages/torch/nn/modules/loss.py", line 482, in forward
    self.ignore_index)
  File "/home/mahsa/anaconda3/envs/pytorch_env/lib/python3.5/site-packages/torch/nn/functional.py", line 746, in cross_entropy
    return nll_loss(log_softmax(input), target, weight, size_average, ignore_index)
  File "/home/mahsa/anaconda3/envs/pytorch_env/lib/python3.5/site-packages/torch/nn/functional.py", line 672, in nll_loss
    return _functions.thnn.NLLLoss.apply(input, target, weight, size_average, ignore_index)
  File "/home/mahsa/anaconda3/envs/pytorch_env/lib/python3.5/site-packages/torch/nn/_functions/thnn/auto.py", line 47, in forward
    output, *ctx.additional_args)
TypeError: FloatClassNLLCriterion_updateOutput received an invalid combination of arguments - got (int, torch.FloatTensor, !torch.DoubleTensor!, torch.FloatTensor, bool, NoneType, torch.FloatTensor, int), but expected (int state, torch.FloatTensor input, torch.LongTensor target, torch.FloatTensor output, bool sizeAverage, [torch.FloatTensor weights or None], torch.FloatTensor total_weight, int ignore_index)

Sorry that this problem is different from the topic but can you guide me? why my target should be torch.Long? because my target is the scores for sentences and they are float.