Bidirectional recurrent neural networks are an extension of RNNs, where the input data is fed in both normal and reverse time order into two networks. The output that's received from both networks is combined in each time step using various kinds of merge modes, such as summation, concatenation, multiplication, and averaging. Bidirectional RNNs are mostly used in challenges where the context of the whole statement or text is dependent on the entire sequence and not just a linear interpretation. Bidirectional RNNs are costly to train due to their long gradient chains.
The following diagram is a pictorial representation of a bidirectional RNN:
In this recipe, we will implement a bidirectional RNN for the sentiment classification of IMDb reviews.