keras/src/backend/tensorflow/trainer.py/TensorFlowTrainer/loss
class TensorFlowTrainer:    def loss(self, y, y_pred, sample_weight=None):
        warnings.warn(
            "`model.loss()` is deprecated. Instead, use "
            "`model.compute_loss(x, y, y_pred, sample_weight, training)`.",
        )
        return self.compute_loss(
            x=None, y=y, y_pred=y_pred, sample_weight=sample_weight
        )