title: 'Invalid shape (28, 28, 1) for image data'
body: <p>This is example of my code:</p>
  <pre><code>    (train_images, train_labels), (test_images, test_labels) = datasets.mnist.load_data()
      
      train_images = train_images.reshape((60000, 28, 28, 1))
      test_images = test_images.reshape((10000, 28, 28, 1))
      
      #train_images, test_images = train_images / 255.0, test_images / 255.0
      train_images = train_images.astype('float32') / 255
      
      test_images = test_images.astype('float32') / 255
      
      plt.imshow(train_images[0])
  
  </code></pre>
  <p>But I'm getting <a href="https://i.stack.imgur.com/7oW8z.png" rel="nofollow noreferrer">Invalid shape (28, 28, 1) for image data error</a></p>