I want to build a seq2seq model with a Bidirectional LSTM encoder (2 layers), but I don't know how is the order of the outputs of the Bidirecional layer. This is the way how I create the Bidirectional layer:
self.lstm_layer = tf.keras.layer.Bidirectional(tf.keras.layers.RNN(tf.keras.layers.StackedRNNCells([tf.keras.layers.LSTMCell(self.enc_units,recurrent_initializer='glorot_uniform') for _ in range(3)]),
return_sequences=True,
return_state=True), merge_mode = 'concat')
And this is the call method:
sequences, (forward_h1, backward_h1), (forward_c1, backward_c1), (forward_h2, backward_h2), (forward_c2, backward_c2) = self.lstm_layer(x, initial_state = hidden)
So, I'm not sure if the outputs are in that order, or if instead first is the forwards outputs and then the backwards.