title: Keras: stacking multiple LSTM layer with
body: <p>I have the following network which works fine:</p>
  
  <pre><code>output = LSTM(8)(output)
  output = Dense(2)(output)
  </code></pre>
  
  <p>Now for the same model, I am trying to stack a few LSTM layer like below:</p>
  
  <pre><code>output = LSTM(8)(output, return_sequences=True)
  output = LSTM(8)(output)
  output = Dense(2)(output)
  </code></pre>
  
  <p>But I got the following errors:</p>
  
  <pre><code>TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-2-0d0ced2c7417&gt; in &lt;module&gt;()
       39 
       40 output = Concatenate(axis=2)([leftOutput,rightOutput])
  ---&gt; 41 output = LSTM(8)(output, return_sequences=True)
       42 output = LSTM(8)(output)
       43 output = Dense(2)(output)
  
  /usr/local/lib/python3.4/dist-packages/keras/layers/recurrent.py in __call__(self, inputs, initial_state, constants, **kwargs)
      480 
      481         if initial_state is None and constants is None:
  --&gt; 482             return super(RNN, self).__call__(inputs, **kwargs)
      483 
      484         # If any of `initial_state` or `constants` are specified and are Keras
  
  /usr/local/lib/python3.4/dist-packages/keras/engine/topology.py in __call__(self, inputs, **kwargs)
      601 
      602             # Actually call the layer, collecting output(s), mask(s), and shape(s).
  --&gt; 603             output = self.call(inputs, **kwargs)
      604             output_mask = self.compute_mask(inputs, previous_mask)
      605 
  
  TypeError: call() got an unexpected keyword argument 'return_sequences'
  </code></pre>
  
  <p>This is confusing because return_sequences is a valid argument based on the Keras document : <code>https://keras.io/layers/recurrent/#lstm</code></p>
  
  <p>What did I do wrong here? Thanks!</p>