maybe you can step through the sequence one element at a time:

lstm = nn.LSTM(3, 3)  # Input dim is 3, output dim is 3
inputs = [autograd.Variable(torch.randn((1, 3))) for _ in range(5)]  # make a sequence of length 5
hidden = (autograd.Variable(torch.randn(1, 1, 3)), autograd.Variable(torch.randn((1, 1, 3))))
for i in inputs:
# Step through the sequence one element at a time. after each step, hidden contains the hidden state.
out, hidden = lstm(i.view(1, 1, -1), hidden)

you can find the code from pytorch tutorial