title: Error when checking model input: expected lstm_1_input to have 3 dimensions, but got array with shape (339732, 29)
body: <p>My input is simply a csv file with 339732 rows and two columns :</p>
  
  <ul>
  <li>the first being 29 feature values, i.e. X</li>
  <li>the second being a binary label value, i.e. Y</li>
  </ul>
  
  <p>I am trying to train my data on a stacked LSTM model:</p>
  
  <pre><code>data_dim = 29
  timesteps = 8
  num_classes = 2
  
  model = Sequential()
  model.add(LSTM(30, return_sequences=True,
                 input_shape=(timesteps, data_dim)))  # returns a sequence of vectors of dimension 30
  model.add(LSTM(30, return_sequences=True))  # returns a sequence of vectors of dimension 30
  model.add(LSTM(30))  # return a single vector of dimension 30
  model.add(Dense(1, activation='softmax'))
  
  model.compile(loss='binary_crossentropy',
                optimizer='rmsprop',
                metrics=['accuracy'])
  
  model.summary()
  model.fit(X_train, y_train, batch_size = 400, epochs = 20, verbose = 1)
  </code></pre>
  
  <p>This throws the error:</p>
  
  <blockquote>
    <p>Traceback (most recent call last):
      File "first_approach.py", line 80, in 
        model.fit(X_train, y_train, batch_size = 400, epochs = 20, verbose = 1)</p>
    
    <p>ValueError: Error when checking model input: expected lstm_1_input to
    have 3 dimensions, but got array with shape (339732, 29)</p>
  </blockquote>
  
  <p>I tried reshaping my input using <code>X_train.reshape((1,339732, 29))</code> but it did not work showing error:</p>
  
  <blockquote>
    <p>ValueError: Error when checking model input: expected lstm_1_input to
    have shape (None, 8, 29) but got array with shape (1, 339732, 29)</p>
  </blockquote>
  
  <p>How can I feed in my input to the LSTM ?</p>