title: Tensorflow from_generator running out of inputs when fitting
body: <p>I am working with images and trying to generate new images based on the <code>tf.keras.preprocessing.image.ImageDataGenerator</code> class in order to augment my dataset. I am having trouble where my generator is running out of examples to generate during the <code>model.fit</code></p>
  <p>Here is the function I used to generate the data and create the dataset</p>
  <pre><code>def tfds_imgen(ds, imgen, batch_size, batches_per):
      for images, labels in ds:
          flow_ = imgen.flow(images, labels, batch_size=batch_size)
          for _ in range(batches_per):
              yield next(flow_)
  
  imgen = tf.keras.preprocessing.image.ImageDataGenerator(rotation_range=60)
  
  gen = tfds_imgen(
      train_ds.as_numpy_iterator(), imgen,
      batch_size=BATCH_SIZE, batches_per=1)
  
  train_ds_gen = tf.data.Dataset.from_generator(
      lambda: gen,
      output_types = (tf.float32, tf.float32),
      output_shapes = ([None, 64, 64, 3], [None, 120]),
  )
  </code></pre>
  <p>Here <code>train_ds</code> is of shape <code>(64,64,3)</code> and I am looking to generate as 1 new image for every image in <code>train_ds</code>. Running this code returns the following error: <code>Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least steps_per_epoch * epochs</code>.</p>
  <p>I understand that the above code only generates 1 epoch worth of images. To fix the issue, I tried increasing the number of images being generated using the <code>batches_per</code> argument to be equal to the number of epochs. This fixes the issue, however, when I try to concatenate the <code>train_ds</code> with the <code>train_ds_gen</code>, I still get a similar issue, since the <code>train_ds_gen</code> has 10x more examples than the <code>train_ds</code>.</p>
  <p>I am looking to get as much generated images as real images in each epoch.</p>
  <p>How do I setup my generator to have enough images to be generated while having a dataset that is balanced between generated and real images.</p>