An \"endpoint layer\" has access to the model's targets, and creates arbitrary losses and metrics using add_loss and add_metric. This enables you to define losses and metrics that don't match the usual signature fn(y_true, y_pred, sample_weight=None).