title: Bidirectional LSTM output question in PyTorch
body: <p>Hi I have a question about how to collect the correct result from a BI-LSTM module’s output.</p>
  
  <p>Suppose I have a 10-length sequence feeding into a single-layer LSTM module with 100 hidden units:</p>
  
  <pre><code>lstm = nn.LSTM(5, 100, 1, bidirectional=True)
  </code></pre>
  
  <p><code>output</code> will be of shape:</p>
  
  <pre><code>[10 (seq_length), 1 (batch),  200 (num_directions * hidden_size)]
  # or according to the doc, can be viewed as
  [10 (seq_length), 1 (batch),  2 (num_directions), 100 (hidden_size)]
  </code></pre>
  
  <p>If I want to get the 3rd (1-index) input’s output at both directions (two 100-dim vectors), how can I do it correctly?</p>
  
  <p>I know <code>output[2, 0]</code> will give me a 200-dim vector. <strong>Does this 200 dim vector represent the output of 3rd input at both directions?</strong></p>
  
  <p>A thing bothering me is that when do reverse feeding, the 3rd (1-index) output vector is calculated from the 8th(1-index) input, right?</p>
  
  <p>Will pytorch automatically take care of this and group output considering direction?</p>
  
  <p>Thanks!</p>