{"record":{"id":"dc939b9148cad223","repo":"tensorflow/models","slug":"the-last-dimension-of-the-inputs-to-tnexpandconde","errorCode":null,"errorMessage":"The last dimension of the inputs to `TNExpandCondense` should be defined. Found `None`.","messagePattern":"The last dimension of the inputs to `TNExpandCondense` should be defined\\. Found `None`\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/modeling/layers/tn_expand_condense.py","lineNumber":85,"sourceCode":"      kwargs['input_shape'] = (kwargs.pop('input_dim'),)\n\n    super().__init__(**kwargs)\n\n    assert proj_multiplier in [\n        2, 4, 6, 8, 10, 12\n    ], 'proj_multiplier needs to be one of [2, 4, 6, 8, 10, 12]'\n    self.proj_multiplier = proj_multiplier\n\n    self.use_bias = use_bias\n    self.activation = activations.get(activation)\n    self.kernel_initializer = initializers.get(kernel_initializer)\n    self.bias_initializer = initializers.get(bias_initializer)\n\n  def build(self, input_shape: List[int]) -> None:\n    # Disable the attribute-defined-outside-init violations in this function\n    # pylint: disable=attribute-defined-outside-init\n    if input_shape[-1] is None:\n      raise ValueError(\n          'The last dimension of the inputs to `TNExpandCondense` '\n          'should be defined. Found `None`.')\n\n    super().build(input_shape)\n\n    self.proj_size = self.proj_multiplier * input_shape[-1]\n\n    assert (self.proj_size // input_shape[-1]) * input_shape[\n        -1] == self.proj_size, (f'{self.proj_size} / {input_shape[-1]} must be '\n                                f'round')\n    assert (input_shape[-1] // 128\n           ) * 128 == input_shape[-1], f'{input_shape[-1]} / 128 must be round'\n\n    self.w1 = self.add_weight(\n        name='w1',\n        shape=(input_shape[-1], input_shape[-1]),\n        trainable=True,\n        initializer=tf_utils.clone_initializer(self.kernel_initializer))","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/modeling/layers/tn_expand_condense.py#L67-L103","documentation":"Error \"The last dimension of the inputs to `TNExpandCondense` should be defined. Found `None`.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/modeling/layers/tn_expand_condense.py:85 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"}