title: Extremely slow training speed with Keras when using steps_per_epoch argument
body: <p>I've noticed tremendous training model speed degradation when I specify  <code>steps_per_epoch</code> argument in <code>model.fit(..)</code> method. When I specify <code>steps_per_epoch</code> as None (or don't use it) epoch's ETA is 2 seconds straight:</p>
  
  <blockquote>
    <p>9120/60000 [===>..........................] - ETA: 2s - loss: 0.7055 - acc: 0.7535</p>
  </blockquote>
  
  <p>When I add <code>steps_per_epoch</code> argument, then ETA bumps up to 5 hours and training speed becomes extremely slow:</p>
  
  <blockquote>
    <p>5/60000 [..............................] - ETA: 5:50:00 - loss: 1.9749 - acc: 0.3437</p>
  </blockquote>
  
  <p>Here is the reproducible script:</p>
  
  <pre class="lang-py prettyprint-override"><code>import tensorflow as tf
  from tensorflow import keras
  import time
  
  print(tf.__version__)
  
  
  def get_model():
      model = keras.Sequential([
          keras.layers.Flatten(input_shape=(28, 28)),
          keras.layers.Dense(128, activation='relu'),
          keras.layers.Dense(10, activation='softmax')
      ])
      model.compile(optimizer='adam',
                    loss='sparse_categorical_crossentropy',
                    metrics=['accuracy'])
      return model
  
  
  (train_images, train_labels), (test_images, test_labels) = keras.datasets.fashion_mnist.load_data()
  train_images = train_images / 255.0
  
  model = get_model()
  
  # Very quick - 2 seconds
  start = time.time()
  model.fit(train_images, train_labels, epochs=1)
  end = time.time()
  print("{} seconds", end - start)
  
  model = get_model()
  
  # Very slow - 5 hours
  start = time.time()
  model.fit(train_images, train_labels, epochs=1, steps_per_epoch=len(train_images))
  end = time.time()
  print("{} seconds", end - start)
  </code></pre>
  
  <p>I've also tried with pure Keras and the problem persisted. I use <code>1.12.0</code> version of Tensorflow, python 3 and Ubuntu 18.04.1 LTS. </p>
  
  <p>Why does <code>steps_per_epoch</code> argument cause such a significant speed degradation and how can I avoid this?</p>
  
  <p>Thanks!</p>