Hi I have a question about how to collect the correct result from a BI-LSTM module’s output.
Suppose I have a
10-length sequence feeding into a single-layer LSTM module with 100 hidden states:
lstm = nn.LSTM(5, 100, 1, bidirectional=True)
output will be have dimension:
[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)]
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?
output[2, 0] will give me a
200-dim vector. Does this
200 dim vector represent the output of 3rd input at both directions?
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?
Will pytorch automatically take care of this and group output considering direction?