Given the following code:
inp = Var(torch.from_numpy(np.random.random((1,10,2))).float())

bidir_lstm = torch.nn.LSTM(2, 5, bidirectional=True)
_,(h10,_) = bidir_lstm(inp[:,:10])
_,(h5,_) = bidir_lstm(inp[:,:5])

h10, h5

I would have expected the values in  h5[1,:,:] to not be equal to the values in h10[1,:5,:]. My understanding of the bidirectional LSTM is that the output from the forward LSTM is then fed into the backward LSTM in reverse order. If the sequence that generated h10 is longer than the sequence that generated h5, then the first value read by the backwards pass of h10 is not the same first value read by the backwards pass of h5, so they should not have the same result. Can somebody explain what I am missing?