Loading...
Combine forward and backward hidden states from a Bidirectional RNN.
In Bidirectional RNNs, we process the sequence in both directions:
The final output at each timestep is typically the concatenation of both directions' hidden states, doubling the feature dimension.
Write a function combine_bidirectional(forward_states, backward_states) that concatenates the forward and backward hidden states along the last dimension.
Return a numpy array of shape (batch_size, seq_len, 2 * hidden_dim).
forward shape (2, 3, 4), backward shape (2, 3, 4)
Shape (2, 3, 8)
Concatenate along the last dimension (axis=-1)