{"record":{"id":"ddcdf2f85b10327f","repo":"tensorflow/models","slug":"unexpected-inputs-to-self-class-with-length-ddcdf2","errorCode":null,"errorMessage":"Unexpected inputs to {self.__class__} with length at {len(inputs)}","messagePattern":"Unexpected inputs to (.+?) with length at (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/longformer/longformer_encoder_block.py","lineNumber":277,"sourceCode":"        `attention mask`] to have separate input streams for the query, and\n        key/value to the multi-head attention.\n\n    Returns:\n      An output tensor with the same dimensions as input/query tensor.\n    \"\"\"\n    if isinstance(inputs, (list, tuple)):\n      if len(inputs) == 4:\n        (\n            input_tensor,\n            attention_mask,\n            is_index_masked,\n            is_index_global_attn,\n        ) = inputs\n        key_value = None\n      elif len(inputs) == 5:\n        assert False  # No key_value\n      else:\n        raise ValueError(\n            f\"Unexpected inputs to {self.__class__} with length at {len(inputs)}\"\n        )\n    else:\n      input_tensor = inputs\n      attention_mask = None\n      is_index_masked = None\n      is_index_global_attn = None\n      key_value = None\n\n    if self._output_range:\n      if self._norm_first:\n        source_tensor = input_tensor[:, 0:self._output_range, :]\n        input_tensor = self._attention_layer_norm(input_tensor)\n        if key_value is not None:\n          key_value = self._attention_layer_norm(key_value)\n      target_tensor = input_tensor[:, 0:self._output_range, :]\n      if attention_mask is not None:\n        attention_mask = attention_mask[:, 0:self._output_range, :]","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/longformer/longformer_encoder_block.py#L259-L295","documentation":"Error \"Unexpected inputs to {self.__class__} with length at {len(inputs)}\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/longformer/longformer_encoder_block.py:277 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"}