output, (hn, cn) = LSTM(packed_input)

hn containing the hidden state for t=seq_len, which means it should be the last element from the output sequence. Even your LSTM takes variable-length of input, it should be something like this:
a b c d 
e f g 0
h i j 0
k l 0 0

# hn:
d
g
j
l