title: Many to one and many to many LSTM examples in Keras
body: <p>I try to understand LSTMs and how to build them with Keras. I found out, that there are principally the 4 modes to run a RNN (the 4 right ones in the picture)</p>
  
  <p><a href="https://i.stack.imgur.com/b4sus.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/b4sus.jpg" alt="enter image description here"></a>
  Image source: <a href="http://karpathy.github.io/2015/05/21/rnn-effectiveness/" rel="noreferrer">Andrej Karpathy</a></p>
  
  <p>Now I wonder how a minimalistic code snippet for each of them would look like in Keras.
  So something like</p>
  
  <pre><code>model = Sequential()
  model.add(LSTM(128, input_shape=(timesteps, data_dim)))
  model.add(Dense(1))
  </code></pre>
  
  <p>for each of the 4 tasks, maybe with a little bit of explanation.</p>