You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thanks for your great tutorial on pytorch! It's a great tip for beginners.
I have a question about the way you use the output of a bidirectional model.
From this code snippet, you took the LAST hidden state of forward and backward LSTM.
I think the image below illustrates what you did with the code. Please refer to this why your code corresponds to the image below. Please note that if we pick the output at the last time step, the reverse RNN will have only seen the last input (x_3 in the picture). It’ll hardly provide any predictive power.(source)
Is this the way you intended?
I think a more information-rich way of using the output of bidirectional LSTM is to concatenate the last hidden state of forward LSTM and first hidden state of reverse LSTM, so that both hidden states will have seen the entire input.
Thanks in advance!
The text was updated successfully, but these errors were encountered:
you are right, surely the output is the concatenated result of the last hidden state of forward LSTM and first hidden state of reverse LSTM, or BP will be wrong
JiahaoYao
added a commit
to JiahaoYao/pytorch-tutorial
that referenced
this issue
May 12, 2019
First of all, thanks for your great tutorial on pytorch! It's a great tip for beginners.
I have a question about the way you use the output of a bidirectional model.
pytorch-tutorial/tutorials/02-intermediate/bidirectional_recurrent_neural_network/main.py
Lines 54 to 58 in 4896cef
From this code snippet, you took the LAST hidden state of forward and backward LSTM.
I think the image below illustrates what you did with the code. Please refer to this why your code corresponds to the image below. Please note that if we pick the output at the last time step, the reverse RNN will have only seen the last input (x_3 in the picture). It’ll hardly provide any predictive power.(source)
Is this the way you intended?
I think a more information-rich way of using the output of bidirectional LSTM is to concatenate the last hidden state of forward LSTM and first hidden state of reverse LSTM, so that both hidden states will have seen the entire input.
Thanks in advance!
The text was updated successfully, but these errors were encountered: