{"record":{"id":"3f90756e94902ba9","repo":"tensorflow/models","slug":"the-linear-layering-config-cannot-be-none-when-u","errorCode":null,"errorMessage":"The linear layering config cannot be `None` when using the linear layering method.","messagePattern":"The linear layering config cannot be `None` when using the linear layering method\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/recommendation/uplift/layers/heads/two_tower_logits_head.py","lineNumber":122,"sourceCode":"    Args:\n      control_head: computes control logits from the control embedding. Its\n        input and output is expected to be a dense tensor.\n      treatment_head: computes treatment logits from the treatment embedding.\n        Its input and output is expected to be a dense tensor.\n      layering_config: configuration for the layering method. Defaults to no\n        layering.\n      **kwargs: base layer keyword arguments.\n    \"\"\"\n    super().__init__(**kwargs)\n\n    self._control_head = control_head\n    self._treatment_head = treatment_head\n    self._layering_config = layering_config\n\n  def build(self, input_shapes: tuple[tf.TensorShape, tf.TensorShape]):\n    if self._layering_config.layering_method == LayeringMethod.LINEAR_LAYERING:\n      if self._layering_config.linear_layering_config is None:\n        raise ValueError(\n            \"The linear layering config cannot be `None` when using the linear\"\n            \" layering method.\"\n        )\n      # Build a learnable weight matrix that projects from the control embedding\n      # space to the treatment embedding space.\n      _, treatment_embedding_shape = input_shapes\n      self._linear_layering = tf_keras.layers.Dense(\n          units=treatment_embedding_shape[-1],\n          activation=None,\n          use_bias=True,\n          kernel_initializer=(\n              self._layering_config.linear_layering_config.kernel_initializer\n          ),\n          kernel_regularizer=(\n              self._layering_config.linear_layering_config.kernel_regularizer\n          ),\n      )\n    super().build(input_shapes)","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/recommendation/uplift/layers/heads/two_tower_logits_head.py#L104-L140","documentation":"Error \"The linear layering config cannot be `None` when using the linear layering method.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/recommendation/uplift/layers/heads/two_tower_logits_head.py:122 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"}