{"record":{"id":"e9568f4756c97ee2","repo":"tensorflow/models","slug":"the-control-logits-and-treatment-logits-computed-b","errorCode":null,"errorMessage":"The control logits and treatment logits computed by the control and treatment heads must be tensors of the same shape, but got shape {control_logits.shape} for the control logits and shape {treatment_logits.shape} for the treatment logits.","messagePattern":"The control logits and treatment logits computed by the control and treatment heads must be tensors of the same shape, but got shape (.+?) for the control logits and shape (.+?) for the treatment logits\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/recommendation/uplift/layers/heads/two_tower_logits_head.py","lineNumber":156,"sourceCode":"          ),\n      )\n    super().build(input_shapes)\n\n  def call(\n      self, inputs: tuple[tf.Tensor, tf.Tensor]\n  ) -> tuple[tf.Tensor, tf.Tensor]:\n    control_embedding, treatment_embedding = inputs\n\n    if self._layering_config.layering_method == LayeringMethod.LINEAR_LAYERING:\n      treatment_embedding += self._linear_layering(\n          tf.stop_gradient(control_embedding)\n      )\n\n    control_logits = self._control_head(control_embedding)\n    treatment_logits = self._treatment_head(treatment_embedding)\n\n    if control_logits.shape != treatment_logits.shape:\n      raise ValueError(\n          \"The control logits and treatment logits computed by the control and\"\n          \" treatment heads must be tensors of the same shape, but got shape\"\n          f\" {control_logits.shape} for the control logits and shape\"\n          f\" {treatment_logits.shape} for the treatment logits.\"\n      )\n\n    if self._layering_config.layering_method == LayeringMethod.LOGIT_SUM:\n      treatment_logits += tf.stop_gradient(control_logits)\n\n    return control_logits, treatment_logits\n\n  def get_config(self) -> dict[str, Any]:\n    config = super().get_config()\n    config[\"layering_config\"] = dataclasses.asdict(self._layering_config)\n\n    for layer_name, layer in (\n        (\"control_head\", self._control_head),\n        (\"treatment_head\", self._treatment_head),","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/recommendation/uplift/layers/heads/two_tower_logits_head.py#L138-L174","documentation":"Error \"The control logits and treatment logits computed by the control and treatment heads must be tensors of the same shape, but got shape {control_logits.shape} for the control logits and shape {treatment_logits.shape} for the treatment logits.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/recommendation/uplift/layers/heads/two_tower_logits_head.py:156 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"}