{"record":{"id":"c8897525635b81be","repo":"tensorflow/models","slug":"inputs-must-have-two-elements","errorCode":null,"errorMessage":"`inputs` must have two elements.","messagePattern":"`inputs` must have two elements\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/perceiver/modeling/layers/decoder.py","lineNumber":127,"sourceCode":"      inputs:\n        Expect inputs to be a tuple of perceiver's decoder query tensor and\n        latent tensor (z). For the cross attention block, `z` is the key-value\n        tensor and decoder query is the query tensor.\n        Latent tensor comes from the self-attention processing blocks and\n        decoder query comes from users to query for the desired output.\n      training:\n        Flag to indicate training status.\n      query_mask:\n        mask used to create the attention mask for the query tensor in the\n        cross attention block.\n\n    Returns:\n      `tf.Tensor` decoded output of latent vector via the query.\n    \"\"\"\n    if not isinstance(inputs, collections.abc.Sequence):\n      raise ValueError(\"`inputs` must be a sequence.\")\n    if len(inputs) != 2:\n      raise ValueError(\"`inputs` must have two elements.\")\n\n    query, z = inputs\n    # Cross-attention decoding.\n    # key, value: B x N x K; query: B x M x K\n    # Attention maps -> B x N x M\n    # Output -> B x M x K\n    # Construct cross attention and linear layer lazily, in case we don't need\n    # them.\n    if query_mask is None:\n      attention_mask = None\n    else:\n      attention_mask = utils.make_cross_attention_mask(\n          query_mask=query_mask,\n          kv_mask=tf.ones(tf.shape(z)[:2], dtype=tf.int32))\n\n    output = self._decoding_cross_attn(\n        (query, z, attention_mask),\n        training=training)","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/perceiver/modeling/layers/decoder.py#L109-L145","documentation":"Raised in PerceiverDecoder.call when the inputs sequence has other than two elements. Exactly a decoder query tensor and a latent tensor (z) are expected.","triggerScenarios":"Thrown at official/projects/perceiver/modeling/layers/decoder.py:127 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Supply exactly (query, z) — no extra tensors or masks inside the sequence","Pass attention masks via the query_mask/mask arguments instead of the inputs tuple"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}