title: What is the architecture behind the Keras LSTM Layer implementation?
body: <p>How does the input dimensions get converted to the output dimensions for the LSTM Layer in Keras? From reading Colah's <a href="http://colah.github.io/posts/2015-08-Understanding-LSTMs/" rel="noreferrer">blog post</a>, it seems as though the number of <code>"timesteps"</code> (AKA the <code>input_dim</code> or the first value in the <code>input_shape</code>) should equal the number of neurons, which should equal the number of outputs from this LSTM layer (delineated by the <code>units</code> argument for the <code>LSTM</code> layer).</p>
  
  <p>From reading <a href="https://stats.stackexchange.com/questions/274478/understanding-input-shape-parameter-in-lstm-with-keras">this post</a>, I understand the input shapes. What I am baffled by is how Keras plugs the inputs into each of the LSTM "smart neurons".</p>
  
  <p><a href="https://keras.io/layers/recurrent/#lstm" rel="noreferrer">Keras LSTM reference</a></p>
  
  <p>Example code that baffles me:</p>
  
  <pre><code>model = Sequential()
  model.add(LSTM(32, input_shape=(10, 64)))
  model.add(Dense(2))
  </code></pre>
  
  <p>From this, I would think that the LSTM layer has 10 neurons and each neuron is fed a vector of length 64. However, it seems it has 32 neurons and I have no idea what is being fed into each. I understand that for the LSTM to connect to the Dense layer, we can just plug all 32 outputs to each of the 2 neurons. What confuses me is the InputLayer to the LSTM.</p>
  
  <p>(<a href="https://stackoverflow.com/questions/39969717/how-to-process-input-and-output-shape-for-keras-lstm">similar SO post but not quite what I need</a>)</p>