I did not look at your code thoroughly but it seems like your code doesn’t work the way the tutorial requires. It says “to get the character level representation, do an LSTM over the characters of a word, and let character-level representation of the word the final hidden state of this LSTM” but I could not find a line for this.
Also, these two lines don’t make sense for me since you reshaped char_lstm_out with len(sentence). The sequence length of a sentence by words and by characters are different.



 mutux:

char_lstm_out, self.char_hidden = self.char_lstm(embedc.view(len(chars), 1, -1), self.char_hidden)
merge_out = torch.cat((lstm_out.view(len(sentence), -1), char_lstm_out.view(len(sentence), -1)), 1)