tensorflow/models · error · ValueError
Unexpected inputs to {self.__class__} with length at {len(in
Error message
Unexpected inputs to {self.__class__} with length at {len(inputs)} What it means
Error "Unexpected inputs to {self.__class__} with length at {len(inputs)}" thrown in tensorflow/models.
Source
Thrown at official/projects/longformer/longformer_encoder_block.py:277
`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) == 4:
(
input_tensor,
attention_mask,
is_index_masked,
is_index_global_attn,
) = inputs
key_value = None
elif len(inputs) == 5:
assert False # No key_value
else:
raise ValueError(
f"Unexpected inputs to {self.__class__} with length at {len(inputs)}"
)
else:
input_tensor = inputs
attention_mask = None
is_index_masked = None
is_index_global_attn = None
key_value = None
if self._output_range:
if self._norm_first:
source_tensor = input_tensor[:, 0:self._output_range, :]
input_tensor = self._attention_layer_norm(input_tensor)
if key_value is not None:
key_value = self._attention_layer_norm(key_value)
target_tensor = input_tensor[:, 0:self._output_range, :]
if attention_mask is not None:
attention_mask = attention_mask[:, 0:self._output_range, :]View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/projects/longformer/longformer_encoder_block.py:277 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/ddcdf2f85b10327f.
Report an issue: GitHub.