@aron-bordin Hey, wouldn’t it be easier if you change this from:



 aron-bordin:

output, _ = self.rnn(packed, prev_hidden)
output, _ = pad_packed_sequence(output, batch_first=True)
get the last time step for each sequence
idx = (seq_sizes - 1).view(-1, 1).expand(output.size(0), output.size(2)).unsqueeze(1)
decoded = output.gather(1, idx).squeeze()


to
output, (ht, ct) = self.rnn(packed, prev_hidden)
decoded = ht[-1]

Both the decoded above should be the same.
Isn’t the output of self.rnn already gave you the output for t=seq_len, even though we have variable-length input?
Also, may I ask what’s your prev_hidden? I thought it should be the initial state for hidden and cell.