def catch_stop_iteration(self):
        """Catches errors when an iterator runs out of data."""
        with super().catch_stop_iteration():
            try:
                yield
                self.tf_sync()
            except tf.errors.OutOfRangeError:
                raise StopIteration
Catches errors when an iterator runs out of data.
keras/src/backend/tensorflow/trainer.py