{"record":{"id":"085ee1647606b4a7","repo":"tensorflow/models","slug":"unexpected-inputs-to-s-with-length-at-d","errorCode":null,"errorMessage":"Unexpected inputs to %s with length at %d","messagePattern":"Unexpected inputs to (.+?) with length at (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/modeling/layers/pack_optimization.py","lineNumber":88,"sourceCode":"  def __init__(self, *args, **kwargs):\n    super().__init__(*args, **kwargs)\n    if self._output_range is not None:\n      raise ValueError('StridedTransformerEncoderBlock does not '\n                       'support `output_range` argument.')\n    # TODO(b/337888023): Support block sparse attention with strided inputs.\n    if self._src_block_size is not None:\n      raise ValueError('StridedTransformerEncoderBlock does not '\n                       'support block sparse attention.')\n\n  def call(self, inputs, stride: tf.Tensor):\n    if isinstance(inputs, (list, tuple)):\n      if len(inputs) == 2:\n        input_tensor, attention_mask = inputs\n        key_value = None\n      elif len(inputs) == 3:\n        input_tensor, key_value, attention_mask = inputs\n      else:\n        raise ValueError('Unexpected inputs to %s with length at %d' %\n                         (self.__class__, len(inputs)))\n    else:\n      input_tensor, key_value, attention_mask = (inputs, None, None)\n\n    if self._norm_first:\n      source_tensor = input_tensor[:, ::stride, :]\n      input_tensor = self._attention_layer_norm(input_tensor)\n      if key_value is not None:\n        key_value = self._attention_layer_norm_kv(key_value)\n    target_tensor = input_tensor[:, ::stride, :]\n    if attention_mask is not None:\n      attention_mask = attention_mask[:, ::stride, :]\n\n    if key_value is None:\n      key_value = input_tensor\n    attention_output = self._attention_layer(\n        query=target_tensor, value=key_value, attention_mask=attention_mask)\n    attention_output = self._attention_dropout(attention_output)","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/modeling/layers/pack_optimization.py#L70-L106","documentation":"Error \"Unexpected inputs to %s with length at %d\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/modeling/layers/pack_optimization.py:88 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"}