title: Why keras LSTM layer requires input shape?
body: <p>I am trying to create simple <code>RNN</code> in <code>keras</code> which will learn over this dataset:</p>
  
  <pre><code>X = np.array([[1, 1, 1, 1, 1, 1], [1, 1, 1], [2, 2, 2, 2, 2], [1, 1, 1, 1, 1, 1, 1, 1], [2, 2, 2]])
  y = np.array([[1], [1], [0], [1], [0]])
  </code></pre>
  
  <p>where 1s arrays is 1 and 2s arrays is 0</p>
  
  <p>here is my code:</p>
  
  <pre><code>from keras.models import Sequential
  from keras.layers import Dense, Activation
  from keras.layers import LSTM
  from keras.optimizers import RMSprop
  import numpy as np
  
  X = np.array([[1, 1, 1, 1, 1, 1], [1, 1, 1], [2, 2, 2, 2, 2], [1, 1, 1, 1, 1, 1, 1, 1], [2, 2, 2]])
  y = np.array([[1], [1], [0], [1], [0]])
  
  print('Build model...')
  model = Sequential()
  model.add(LSTM(128))
  model.add(Dense(1))
  model.add(Activation('softmax'))
  
  optimizer = RMSprop(lr=0.01)
  model.compile(loss='categorical_crossentropy', optimizer=optimizer)
  </code></pre>
  
  <p>but I'm getting the error:</p>
  
  <blockquote>
    <p>ValueError: The first layer in a Sequential model must get an
    <code>input_shape</code> or <code>batch_input_shape</code> argument.</p>
  </blockquote>
  
  <p>why does <code>LSTM</code> layer should have input shape? as I know, in theory, there can be different input shapes, cause this is recurrent neural network.</p>
  
  <p>how to make my code work?</p>