tensorflow/models · error · ValueError
Unexpected inputs type (%s) to %s.
Error message
Unexpected inputs type (%s) to %s.
What it means
Error "Unexpected inputs type (%s) to %s." thrown in tensorflow/models.
Source
Thrown at official/nlp/modeling/networks/sparse_mixer.py:312
input_mask=tf_keras.Input(
shape=(max_sequence_length,), dtype=tf.int32),
input_type_ids=tf_keras.Input(
shape=(max_sequence_length,), dtype=tf.int32))
self._max_sequence_length = max_sequence_length
def call(self, inputs):
word_embeddings = None
if isinstance(inputs, dict):
word_ids = inputs.get('input_word_ids')
mask = inputs.get('input_mask')
type_ids = inputs.get('input_type_ids')
word_embeddings = inputs.get('input_word_embeddings', None)
dense_inputs = inputs.get('dense_inputs', None)
dense_mask = inputs.get('dense_mask', None)
dense_type_ids = inputs.get('dense_type_ids', None)
else:
raise ValueError('Unexpected inputs type (%s) to %s.' %
(type(inputs), self.__class__))
if word_embeddings is None:
word_embeddings = self._embedding_layer(word_ids)
if dense_inputs is not None:
# Concat the dense embeddings at sequence end.
word_embeddings = tf.concat([word_embeddings, dense_inputs], axis=1)
type_ids = tf.concat([type_ids, dense_type_ids], axis=1)
mask = tf.concat([mask, dense_mask], axis=1)
# SparseMixer: Sequence length must be the same as `max_sequence_length`.
word_embeddings = tf.ensure_shape(word_embeddings,
[None, self._max_sequence_length, None])
# Absolute position embeddings.
position_embeddings = self._position_embedding_layer(word_embeddings)
type_embeddings = self._type_embedding_layer(type_ids)View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/nlp/modeling/networks/sparse_mixer.py:312 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/069c78273ddf3001.
Report an issue: GitHub.