def _compute_loss(
        self,
        x=None,
        y=None,
        y_pred=None,
        sample_weight=None,
        training=True,
    ):
        """Backwards compatibility wrapper for `compute_loss`.

        This should be used instead `compute_loss` within `train_step` and
        `test_step` to support overrides of `compute_loss` that may not have
        the `training` argument, as this argument was added in Keras 3.3.
        """
        if self._compute_loss_has_training_arg:
            return self.compute_loss(
                x, y, y_pred, sample_weight, training=training
            )
        else:
            return self.compute_loss(x, y, y_pred, sample_weight)
Backwards compatibility wrapper for `compute_loss`.

        This should be used instead `compute_loss` within `train_step` and
        `test_step` to support overrides of `compute_loss` that may not have
        the `training` argument, as this argument was added in Keras 3.3.
        
keras/src/trainers/trainer.py