title: How to pass Bidirectional LSTM state to earlier LSTM layer?
body: <p>I'm trying to do a seq2seq model with and encoder LSTM and decoder LSTM, both with <code>Bidirectional</code> layers.</p>
  <p>I can pass the hidden state and memory cell forward to the decoder LSTM, but I can't see how I'd possibly pass the values back from the decoder to the encoder.</p>
  <pre><code>def sequence_model(total_words, emb_dimension, lstm_units):
      # Encoder
      encoder_input = Input(shape=(None,), name=&quot;Enc_Input&quot;)
      x = Embedding(total_words, emb_dimension, input_length=max_sequence_length, name=&quot;Enc_Embedding&quot;)(encoder_input)
      x, state_h, state_c, _, _ = Bidirectional(LSTM(lstm_units, return_state=True, name=&quot;Enc_LSTM1&quot;), name=&quot;Enc_Bi1&quot;)(x) # pass hidden activation and memory cell states forward
      encoder_states = [state_h, state_c] # package states to pass to decoder
      
      # Decoder
      decoder_input = Input(shape=(None,), name=&quot;Dec_Input&quot;)
      x = Embedding(total_words, emb_dimension, name=&quot;Dec_Embedding&quot;)(decoder_input)
      x = LSTM(lstm_units, return_sequences=True, name=&quot;Dec_LSTM1&quot;)(x, initial_state=encoder_states)
      decoder_output = Dense(total_words, activation=&quot;softmax&quot;, name=&quot;Dec_Softmax&quot;)(x)
  
      func_model = tf.keras.Model(inputs=[encoder_input,decoder_input], outputs=decoder_output)
      return func_model
  </code></pre>
  <p>The forward states are passed to the <code>initial_state</code> of the decoder LSTM layer. But if I wrap this <code>Dec_LSTM1</code> layer with a <code>Bidirectional</code> Layer, it doesn't like me passing the <code>initial_state</code> value in and breaks.</p>
  <p>Am I right in thinking I don't need the backwards states from the encoder LSTM layer?</p>
  <p>Attached is an image of the architecture I'm trying to achieve.</p>
  <p><a href="https://i.stack.imgur.com/fC02Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fC02Q.png" alt="enter image description here" /></a></p>