title: Error defining an input shape in keras for (60000, 28, 28) array
body: <p>I am setting up my first neural network with keras and tensorflow. I got my input into an array of shape (60000, 28, 28), but when I try and feed it to the model I get an error that the input shape is wrong.</p>
  
  <p>I have tried multiple different input shapes including (60000, 28, 28) (1, 28, 28) (28, 28) (28, 28, 1) but none of them seem to work.</p>
  
  <pre class="lang-py prettyprint-override"><code>model = kr.Sequential()
  
  model.add(InputLayer(input_shape=(60000, 28, 28)))
  model.add(Dense(units=784, activation='relu'))
  model.add(Dense(units=392, activation='relu'))
  model.add(Dense(units=196, activation='relu'))
  model.add(Dense(units=10, activation='softmax'))
  
  model.compile(loss='categorical_crossentropy', optimizer='Adam', metrics=['accuracy'])
  
  training = model.fit(x=images_array, y=labels_array, epochs=10, batch_size=256)
  </code></pre>
  
  <p>I would expect it to work with input shape (60000, 28, 28) but I always get this error:</p>
  
  <blockquote>
    <p>ValueError: Error when checking input: expected input_1 to have 4
    dimensions, but got array with shape (60000, 28, 28)</p>
  </blockquote>
  
  <p><strong>Edit:</strong></p>
  
  <p>Thanks to everyone who answerd. cho_uc answer indeed worked, which is why I accepted it.
  What I shold have mentioned in the post was, that I was trying to build a model consisting only of Dense layers, so I can use it as a benchmark for future models.</p>
  
  <p>I solved the input layer problem with:</p>
  
  <pre class="lang-py prettyprint-override"><code>images_array = images_array.reshape(-1, 28 * 28)
  
  model.add(InputLayer(input_shape=(784, )))
  </code></pre>