Hi, I have a text corpus and I have a score for each sentence of it. I want to make a RNN model to predict these scores. I have written some codes to do it. In train phase, a batch of data (sentence-score samples) is given to my classifier by:
output=classifier(input,seq_lengths)
input is a tensor that each row of it is a sequence of word embedding vectors of the words in a sentence.
seq_lengths is a list of its sentence lengths.
input is a tensor with size:
batch_size*(max_length_of_sentences*word_embedding_vector_length)
but I get an error in running this line of code:
embedded=self.embedding(input)
the error is:
Traceback (most recent call last):
File "/home/mahsa/PycharmProjects/PyTorch_env_project/Thesis/proj2/mahsa_rnn_sent_classification.py", line 277, in <module>
train()
File "/home/mahsa/PycharmProjects/PyTorch_env_project/Thesis/proj2/mahsa_rnn_sent_classification.py", line 238, in train
output = classifier(input, seq_lengths)
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/PycharmProjects/PyTorch_env_project/Thesis/proj2/mahsa_rnn_sent_classification.py", line 212, in forward
embedded = self.embedding(input)
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/sparse.py", line 94, in forward
self.scale_grad_by_freq, self.sparse
File "/home/mahsa/anaconda3/envs/pytorch_env/lib/python3.5/site-packages/torch/nn/_functions/thnn/sparse.py", line 53, in forward
output = torch.index_select(weight, 0, indices.view(-1))
TypeError: torch.index_select received an invalid combination of arguments - got (torch.FloatTensor, int, !torch.FloatTensor!), but expected (torch.FloatTensor source, int dim, torch.LongTensor index)
can you guide me?