Hi! I was wondering how to recover the last output element of the backward direction of a RNN.
Imagine my input sentence is:
“The quick brown fox jumped over the lazy dogs”
For the backward direction, I would like to recover the last hidden state for the word The (last one in the reversed sequence).
After I separate the two directions (assume batch_first=True) using:
out = out.view(batch_size, seq_length, 2, hidden_size)

and recover the backward direction using:
backward = out[:,:,1,:]

if I want to recover the output for the word The, this should be:
y = backward[:,0,:]

or do I need to take the last index as for the forward direction?
y = backward[:,-1,:]