{"record":{"id":"8c356ef0bab732ab","repo":"tensorflow/models","slug":"value-passed-to-from-logits-from-logits-is-c","errorCode":null,"errorMessage":"Value passed to `from_logits` ({from_logits}) is conflicting with the `from_logits` value passed to the `loss_fn` metric ({metric_from_logits}). Ensure that they have the same value.","messagePattern":"Value passed to `from_logits` \\((.+?)\\) is conflicting with the `from_logits` value passed to the `loss_fn` metric \\((.+?)\\)\\. Ensure that they have the same value\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/recommendation/uplift/metrics/loss_metric.py","lineNumber":111,"sourceCode":"          \"`loss_fn` cannot be a Keras `Loss` object, pass a non-reducing loss\"\n          \" function or a metric instance instead.\"\n      )\n\n    if isinstance(loss_fn, tf_keras.metrics.Metric):\n      name = loss_fn.name\n      dtype = loss_fn.dtype\n\n    super().__init__(name=name, dtype=dtype)\n\n    self._loss_fn = loss_fn\n    self._from_logits = from_logits\n    self._loss_fn_kwargs = loss_fn_kwargs\n    self._slice_by_treatment = slice_by_treatment\n\n    if isinstance(loss_fn, tf_keras.metrics.Metric):\n      metric_from_logits = loss_fn.get_config().get(\"from_logits\", from_logits)\n      if from_logits != metric_from_logits:\n        raise ValueError(\n            f\"Value passed to `from_logits` ({from_logits}) is conflicting with\"\n            \" the `from_logits` value passed to the `loss_fn` metric\"\n            f\" ({metric_from_logits}). Ensure that they have the same value.\"\n        )\n      loss_metric = loss_fn\n\n    else:\n      if \"from_logits\" in inspect.signature(loss_fn).parameters:\n        self._loss_fn_kwargs.update({\"from_logits\": from_logits})\n      loss_metric = tf_keras.metrics.Mean(name=name, dtype=dtype)\n\n    if slice_by_treatment:\n      self._loss = treatment_sliced_metric.TreatmentSlicedMetric(loss_metric)\n    else:\n      self._loss = loss_metric\n\n  def update_state(\n      self,","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/recommendation/uplift/metrics/loss_metric.py#L93-L129","documentation":"Error \"Value passed to `from_logits` ({from_logits}) is conflicting with the `from_logits` value passed to the `loss_fn` metric ({metric_from_logits}). Ensure that they have the same value.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/recommendation/uplift/metrics/loss_metric.py:111 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}