# Confused about steps_per_epoch and validation_steps in Keras

According to the documentation in TF 2:

       steps_per_epoch: Integer or None.
Total number of steps (batches of samples)
before declaring one epoch finished and starting the
next epoch. When training with input tensors such as
TensorFlow data tensors, the default None is equal to
the number of samples in your dataset divided by
the batch size, or 1 if that cannot be determined. If x is a
tf.data dataset, and 'steps_per_epoch'
is None, the epoch will run until the input dataset is exhausted.
This argument is not supported with array inputs.
validation_steps: Only relevant if validation_data is provided and
is a tf.data dataset. Total number of steps (batches of
samples) to draw before stopping when performing validation
at the end of every epoch. If validation_data is a tf.data dataset
and 'validation_steps' is None, validation
will run until the validation_data dataset is exhausted.


I don't understand this part:

Total number of steps (batches of samples)
before declaring one epoch finished and starting the
next epoch.


If I have 1000 samples, batch size = 100, then an epoch will take 10 steps to reach. Why is another steps_per_epoch is needed? If both are used, they are conflicting. Isn't it? If the batch size is 100, then 10 steps are needed. If also steps_per_epoch = 20, then it means in one epoch it needs 20 batches, which is conflicting with the '10' steps calculated through the batch size parameter 100.

Where am I wrong?

Usually it is equal to n_samples // batch_size, BUT
steps_per_epoch give you the chance to feeding process of the NN when updating the learning rate using ReduceLROnPlateuau(). This callback checks the drop of the loss once each epoch has finished and if the loss has stagnated for a patience number of consecutive epochs, the callback decreases the learning rate to "slow-cook" the network. If your dataset is huge, as it is usually the case when you need to use generators, you would probably like to decay the learning rate within a single epoch (since it includes a big number of data). This can be achieved by setting steps_per_epoch to a value that is less than n_samples // batch_size without affecting the overall number of training epochs of your model.