tensorflow/models · error · ValueError

Unexpected inputs to %s with length at %d

Error message

Unexpected inputs to %s with length at %d

What it means

Error "Unexpected inputs to %s with length at %d" thrown in tensorflow/models.

Source

Thrown at official/projects/lra/moving_average_gated_attention.py:269

    Args:
      inputs: a single tensor or a list of tensors. `input tensor`
        as the single sequence of embeddings. [`input tensor`,
        `attention mask`] to have the
        additional attention mask. [`query tensor`, `key value tensor`,
        `attention mask`] to have separate input streams for the query, and
        key/value to the multi-head attention.
    Returns:
      An output tensor with the same dimensions as input/query tensor.
    """
    if isinstance(inputs, (list, tuple)):
      if len(inputs) == 2:
        (input_tensor, attention_mask) = inputs
        key_value = None
      elif len(inputs) == 3:
        (input_tensor, key_value, attention_mask) = inputs
      else:
        raise ValueError(
            "Unexpected inputs to %s with length at %d"
            % (self.__class__, len(inputs))
        )
    else:
      (input_tensor, key_value, attention_mask) = (inputs, None, None)

    if self.prenorm:
      input_tensor = self.norm(input_tensor)
      if key_value is not None:
        key_value = self.norm(key_value)

    ## B*L*D -> L*B*D
    ## Multi-Dimensional Damped EMA
    x = tf.transpose(input_tensor, perm=[1, 0, 2])
    residual = x

    seq_len, bsz, _ = x.shape

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/lra/moving_average_gated_attention.py:269 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24). Data as JSON: /api/errors/a7f505bd1f684f9b. Report an issue: GitHub.