title: How to use repeat() function when building data in Keras?
body: <p>I am training a binary classifier on a dataset of cats and dogs:<br />
  Total Dataset: 10000 images<br />
  Training Dataset: 8000 images<br />
  Validation/Test Dataset: 2000 images<br /></p>
  
  <p>The Jupyter notebook code:<br /></p>
  
  <pre><code># Part 2 - Fitting the CNN to the images
  train_datagen = ImageDataGenerator(rescale = 1./255,
                                     shear_range = 0.2,
                                     zoom_range = 0.2,
                                     horizontal_flip = True)
  
  test_datagen = ImageDataGenerator(rescale = 1./255)
  
  training_set = train_datagen.flow_from_directory('dataset/training_set',
                                                   target_size = (64, 64),
                                                   batch_size = 32,
                                                   class_mode = 'binary')
  
  test_set = test_datagen.flow_from_directory('dataset/test_set',
                                              target_size = (64, 64),
                                              batch_size = 32,
                                              class_mode = 'binary')
  
  history = model.fit_generator(training_set,
                                steps_per_epoch=8000,
                                epochs=25,
                                validation_data=test_set,
                                validation_steps=2000)
  </code></pre>
  
  <p>I trained it on a CPU without a problem but when I run on GPU it throws me this error:</p>
  
  <pre><code>Found 8000 images belonging to 2 classes.
  Found 2000 images belonging to 2 classes.
  WARNING:tensorflow:From &lt;ipython-input-8-140743827a71&gt;:23: Model.fit_generator (from tensorflow.python.keras.engine.training) is deprecated and will be removed in a future version.
  Instructions for updating:
  Please use Model.fit, which supports generators.
  WARNING:tensorflow:sample_weight modes were coerced from
    ...
      to  
    ['...']
  WARNING:tensorflow:sample_weight modes were coerced from
    ...
      to  
    ['...']
  Train for 8000 steps, validate for 2000 steps
  Epoch 1/25
   250/8000 [..............................] - ETA: 21:50 - loss: 7.6246 - accuracy: 0.5000
  WARNING:tensorflow:Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least `steps_per_epoch * epochs` batches (in this case, 200000 batches). You may need to use the repeat() function when building your dataset.
   250/8000 [..............................] - ETA: 21:52 - loss: 7.6246 - accuracy: 0.5000
  </code></pre>
  
  <p>I would like to know how to use the repeat() function in keras using Tensorflow 2.0?</p>