keras/src/trainers/epoch_iterator.py/EpochIterator/num_batches
class EpochIterator:    def num_batches(self):
        if self.steps_per_epoch:
            return self.steps_per_epoch
        # Either copied from the data_adapter, or
        # inferred at the end of an iteration.
        return self._num_batches