tensorflow/models · error · ValueError

Unexpected inputs type to %s.

Error message

Unexpected inputs type to %s.

What it means

Error "Unexpected inputs type to %s." thrown in tensorflow/models.

Source

Thrown at official/projects/mae/modeling/vit.py:116

    self.token_cls = vit.TokenLayer()
    super().build(input_shape)

  def to_embed(self, patches):
    return self.patch_to_embed(patches)

  def insert_cls(self, patch_embeds):
    return self.token_cls(patch_embeds)

  def add_position_embed(self, patch_embeds):
    return patch_embeds + utils.position_embedding_sine(
        tf.ones_like(patch_embeds[..., 0]), 1024, normalize=False)

  def call(self, inputs):  # pytype: disable=signature-mismatch  # overriding-parameter-count-checks
    if isinstance(inputs, dict):
      images = inputs.get('images', None)
      patch_embeds = inputs.get('embeddings', None)
    else:
      raise ValueError('Unexpected inputs type to %s.' % self.__class__)
    if images is not None:
      patches = to_patch(images, self.patch_h, self.patch_w)
      patch_embeds = self.to_embed(patches)
      patch_shape = tf.shape(patch_embeds)
      patch_embeds = self.add_position_embed(patch_embeds)
      patch_embeds = tf.reshape(patch_embeds,
                                (patch_shape[0], -1, patch_shape[-1]))
      patch_embeds = self.insert_cls(patch_embeds)
    return self.encoder(patch_embeds)

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/mae/modeling/vit.py:116 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/5fb2d41ce643bd2b. Report an issue: GitHub.