tensorflow/models · error · NotImplementedError
Full loss computation is not yet supported.
Error message
Full loss computation is not yet supported.
What it means
Constructor guard in the mean-baseline Poisson metric: compute_full_loss=True was requested, but the full-loss computation for the mean predictor baseline is not implemented, so the option cannot be honored.
Solutions
- Leave compute_full_loss at its default False
- Compute the full loss with a separate custom metric if strictly needed
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/recommendation/uplift/metrics/poisson_metrics.py:159 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/d96af39e8f6dc99c.
Report an issue: GitHub.
Appendix: source
Thrown at official/recommendation/uplift/metrics/poisson_metrics.py:159
name: str = "poisson_log_loss_mean_baseline",
dtype: tf.DType = tf.float32,
):
"""Initializes the instance.
Args:
compute_full_loss: Specifies whether to compute the full poisson log loss
for the mean predictor or not. Defaults to `False`.
slice_by_treatment: Specifies whether the loss should be sliced by the
treatment indicator tensor. If `True`, the metric's result will return
the loss values sliced by the treatment group. Note that this can only
be set to `True` when `y_pred` is of type `TwoTowerTrainingOutputs`.
name: Optional name for the instance.
dtype: Optional data type for the instance.
"""
super().__init__(name=name, dtype=dtype)
if compute_full_loss:
raise NotImplementedError("Full loss computation is not yet supported.")
self._compute_full_loss = compute_full_loss
self._slice_by_treatment = slice_by_treatment
if slice_by_treatment:
self._mean_label = treatment_sliced_metric.TreatmentSlicedMetric(
metric=tf_keras.metrics.Mean(name=name, dtype=dtype)
)
else:
self._mean_label = tf_keras.metrics.Mean(name=name, dtype=dtype)
def update_state(
self,
y_true: tf.Tensor,
y_pred: types.TwoTowerTrainingOutputs | tf.Tensor | None = None,
sample_weight: tf.Tensor | None = None,
):
is_treatment = {}View on GitHub (pinned to e006f5f0d5)