figure training and validat ion loss on he jena temperat ureforecast ing ask wit st acked gru net work using bidirectional rnns the last technique introduced in this section is called bidirectional rnns bidirectional rnn is common rnn variant that can offer greater performance than regular rnn on certain tasks it' frequently used in natural-language processing--you could call it the swiss army knife of deep learning for natural-language processing rnns are notably order dependentor time dependentthey process the timesteps of their input sequences in orderand shuffling or reversing the timesteps can completely change the representations the rnn extracts from the sequence this is precisely the reason they perform well on problems where order is meaningfulsuch as the temperature-forecasting problem bidirectional rnn exploits the order sensitivity of rnnsit consists of using two regular rnnssuch as the gru and lstm layers you're already familiar witheach of which processes the input sequence in one direction (chronologically and antichronologically)and then merging their representations by processing sequence both waysa bidirectional rnn can catch patterns that may be overlooked by unidirectional rnn remarkablythe fact that the rnn layers in this section have processed sequences in chronological order (older timesteps firstmay have been an arbitrary decision at leastit' decision we made no attempt to question so far could the rnns have performed well enough if they processed input sequences in antichronological orderfor instance (newer timesteps first)let' try this in practice and see what happens all you need to do is write variant of the data generator where the input sequences are reverted along the time dimension (replace the last line with yield samples[:::- :]targetstraining the same one-gru-layer network that you used in the first experiment in this sectionyou get the results shown in figure licensed to