title: Keras LSTM - 'Error when checking model target: expected no data, but got:' data
body: <p>I am doing simple sequence prediction. My model and data look like this:</p>
  <pre><code>def generate_rnn(input_shape):
      In = Input(shape=(input_shape[1], 1))
      x = LSTM(4)(In)
      x = Flatten()(x) # I tried both with and without flatten, same results
      Out = Dense(1)(x)
      
      model = Model([In, Out])
      model.compile(optimizer=Adam(), loss='MSE', metrics=['mse'])
      
      return model
  
  X = np.random.rand(100, 5)
  y = np.random.rand(100, 1)
  X = X.reshape(X.shape[0], X.shape[1], 1)
  
  rnn = generate_rnn(X.shape)
  rnn.fit(X, y, epochs=10)
  </code></pre>
  <p>Firtst time when I run the program, at function call <code>rnn.fit()</code> I get following error message:</p>
  <blockquote>
  <p>File
  &quot;C:\Users\achib\Anaconda3\envs\deep\lib\site-packages\tensorflow_core\python\keras\backend.py&quot;,
  line 1237, in dtype
  return x.dtype.base_dtype.name</p>
  <p>AttributeError: 'NoneType' object has no attribute 'dtype'</p>
  </blockquote>
  <p>If I run <code>rnn.fit()</code> again in console, I get following error message:</p>
  <blockquote>
  <p>ValueError: ('Error when checking model target: expected no data, but
  got:',</p>
  </blockquote>
  <p>And then my <code>y</code> variable gets printed. I have worked with LSTM networks in Keras before, but its my first time encountering such an issue? Any help?</p>