{"record":{"id":"25295361f06a8aea","repo":"tensorflow/models","slug":"unexpected-inputs-to-s-with-length-at-d-252953","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/vision/modeling/layers/nn_blocks.py","lineNumber":2644,"sourceCode":"        'stochastic_depth_drop_rate': self._stochastic_depth_drop_rate,\n        'layer_scale_init_value': self._layer_scale_init_value,\n        'transformer_partition_dims': self._transformer_partition_dims,\n        'max_attention_inference_parallelism': (\n            self._max_attention_inference_parallelism\n        ),\n    })\n    return config\n\n  def call(self, inputs, output_range=None, training=None):\n    \"\"\"Transformer self-attention encoder block call.\"\"\"\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 output_range is None:\n      output_range = self._output_range\n    if output_range:\n      if self._norm_first:\n        source_tensor = input_tensor[:, 0: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:output_range, :]\n      if attention_mask is not None:\n        attention_mask = attention_mask[:, 0:output_range, :]\n    else:\n      if self._norm_first:\n        source_tensor = input_tensor","sourceCodeStart":2626,"sourceCodeEnd":2662,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/modeling/layers/nn_blocks.py#L2626-L2662","documentation":"Error \"Unexpected inputs to %s with length at %d\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/modeling/layers/nn_blocks.py:2644 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the expected number of input tensors to the block as shown in the error.","Check the block's call signature and supply exactly the required inputs."],"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"}