keras/src/callbacks/lambda_callback.py/LambdaCallback/__init__
class LambdaCallback:    def __init__(
        self,
        on_epoch_begin=None,
        on_epoch_end=None,
        on_train_begin=None,
        on_train_end=None,
        on_train_batch_begin=None,
        on_train_batch_end=None,
        **kwargs,
    ):
        super().__init__()
        self.__dict__.update(kwargs)
        if on_epoch_begin is not None:
            self.on_epoch_begin = on_epoch_begin
        if on_epoch_end is not None:
            self.on_epoch_end = on_epoch_end
        if on_train_begin is not None:
            self.on_train_begin = on_train_begin
        if on_train_end is not None:
            self.on_train_end = on_train_end
        if on_train_batch_begin is not None:
            self.on_train_batch_begin = on_train_batch_begin
        if on_train_batch_end is not None:
            self.on_train_batch_end = on_train_batch_end