title: ValueError: Data cardinality is ambiguous
body: <p>I'm trying to train LSTM network on data taken from a DataFrame.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>x_lstm=x.to_numpy().reshape(1,x.shape[0],x.shape[1])
  
  model = keras.models.Sequential([
      keras.layers.LSTM(x.shape[1], return_sequences=True, input_shape=(x_lstm.shape[1],x_lstm.shape[2])),
      keras.layers.LSTM(NORMAL_LAYER_SIZE, return_sequences=True),
      keras.layers.LSTM(NORMAL_LAYER_SIZE),
      keras.layers.Dense(y.shape[1])
  ])
  
  optimizer=keras.optimizers.Adadelta()
  
  model.compile(loss="mse", optimizer=optimizer)
  for i in range(150):
      history = model.fit(x_lstm, y)
      save_model(model,'tmp.rnn')
  </code></pre>
  
  <p>This fails with </p>
  
  <pre><code>ValueError: Data cardinality is ambiguous:
    x sizes: 1
    y sizes: 99
  Please provide data which shares the same first dimension.
  </code></pre>
  
  <p>When I change model to</p>
  
  <pre><code>model = keras.models.Sequential([
      keras.layers.LSTM(x.shape[1], return_sequences=True, input_shape=x_lstm.shape),
      keras.layers.LSTM(NORMAL_LAYER_SIZE, return_sequences=True),
      keras.layers.LSTM(NORMAL_LAYER_SIZE),
      keras.layers.Dense(y.shape[1])
  ])
  </code></pre>
  
  <p>it fails with following error:</p>
  
  <pre><code>Input 0 of layer lstm_9 is incompatible with the layer: expected ndim=3, found ndim=4. Full shape received: [None, 1, 99, 1200]
  </code></pre>
  
  <p>How do I get this to work?</p>
  
  <p>x has shape of <code>(99, 1200)</code> (99 items with 1200 features each, this is just sample a larger dataset), y has shape <code>(99, 1)</code></p>