Okay, I figured out what I was doing wrong. The first dimension is the sequence length, second dimension is the batch size. I had them reversed and interpreted the output as the hidden state at each timestep, but it was actually the hidden state for 10 different batches.
Can anyone explain the motivation for putting the sequence length in the first dimension? I find it counter-intuitive.
And thank you to @wasiahmad for your question, here:

  
    
    
    How to retrieve hidden states for all time steps in LSTM or BiLSTM? 
  
  
    According to the docs of nn.LSTM outputs: 
output (seq_len, batch, hidden_size * num_directions): tensor containing the output features (h_t) from the last layer of the RNN, for each t. If a torch.nn.utils.rnn.PackedSequence has been given as the input, the output will also be a packed sequence.
h_n (num_layers * num_directions, batch, hidden_size): tensor containing the hidden state for t=seq_len
c_n (num_layers * num_directions, batch, hidden_size): tensor containing the cell state for t=seq_l…