title: Keras InvalidArgumentError With Model.Fit()
body: <p>I am trying to call <code>model.fit()</code> on a sequential Keras model, but get this error:</p>
  
  <pre><code>---------------------------------------------------------------------------
  InvalidArgumentError                      Traceback (most recent call last)
  &lt;ipython-input-30-3fc420144082&gt; in &lt;module&gt;
       15     return model
       16 
  ---&gt; 17 trained_model = build_model()
  
  &lt;ipython-input-30-3fc420144082&gt; in build_model()
       10     # fit model
       11     es = tf.keras.callbacks.EarlyStopping(monitor='val_loss', min_delta=1)
  ---&gt; 12     model.fit(train_data[0], train_data[1], epochs=100,verbose=1)
       13     # validation_data = (val_data[0], val_data[1])
       14     print(model.summary())
  
  ~/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, max_queue_size, workers, use_multiprocessing, **kwargs)
      878           initial_epoch=initial_epoch,
      879           steps_per_epoch=steps_per_epoch,
  --&gt; 880           validation_steps=validation_steps)
      881 
      882   def evaluate(self,
  
  ~/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training_arrays.py in model_iteration(model, inputs, targets, sample_weights, batch_size, epochs, verbose, callbacks, val_inputs, val_targets, val_sample_weights, shuffle, initial_epoch, steps_per_epoch, validation_steps, mode, validation_in_fit, **kwargs)
      327 
      328         # Get outputs.
  --&gt; 329         batch_outs = f(ins_batch)
      330         if not isinstance(batch_outs, list):
      331           batch_outs = [batch_outs]
  
  ~/.local/lib/python3.6/site-packages/tensorflow/python/keras/backend.py in __call__(self, inputs)
     3074 
     3075     fetched = self._callable_fn(*array_vals,
  -&gt; 3076                                 run_metadata=self.run_metadata)
     3077     self._call_fetch_callbacks(fetched[-len(self._fetches):])
     3078     return nest.pack_sequence_as(self._outputs_structure,
  
  ~/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py in __call__(self, *args, **kwargs)
     1437           ret = tf_session.TF_SessionRunCallable(
     1438               self._session._session, self._handle, args, status,
  -&gt; 1439               run_metadata_ptr)
     1440         if run_metadata:
     1441           proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)
  
  ~/.local/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py in __exit__(self, type_arg, value_arg, traceback_arg)
      526             None, None,
      527             compat.as_text(c_api.TF_Message(self.status.status)),
  --&gt; 528             c_api.TF_GetCode(self.status.status))
      529     # Delete the underlying status object from memory otherwise it stays alive
      530     # as there is a reference to status from this from the traceback due to
  
  InvalidArgumentError: data[0].shape = [3] does not start with indices[0].shape = [2]
       [[{{node training_40/Adam/gradients/loss_21/dense_21_loss/MeanSquaredError/Mean_grad/DynamicStitch}}]]
  </code></pre>
  
  <p>I have created a set of training points, each 1 x 3, called by train_data[0] and a set of training labels, each 1x1 called by train_data[1].  This is the code I use to build the model:</p>
  
  <pre><code>def build_model():
      '''
      Function to build a LSTM RNN model that takes in quantitiy, converted week; outputs predicted price
      '''
      # define model
      model = tf.keras.Sequential()
      model.add(tf.keras.layers.LSTM(128, activation='relu', input_shape=(num_steps,num_features*input_size)))
      model.add(tf.keras.layers.Dense(input_size))
      model.compile(optimizer='adam', loss='mse')
      # fit model
      es = tf.keras.callbacks.EarlyStopping(monitor='val_loss', min_delta=1)
      model.fit(train_data[0], train_data[1], epochs=100,verbose=1)
      # validation_data = (val_data[0], val_data[1])
      print(model.summary())
      return model
  
  trained_model = build_model()
  </code></pre>
  
  <p>I'm unsure of why, but when I call <code>model.fit(train_data, epochs = 100)</code> and do not break it up into points and labels, everything works well. Any insights would be much appreciated!</p>