tensorflow/models · error · ValueError

The type of input shape argument is not supported, got: %s

Error message

The type of input shape argument is not supported, got: %s

What it means

Error "The type of input shape argument is not supported, got: %s" thrown in tensorflow/models.

Source

Thrown at official/nlp/modeling/layers/reuse_transformer.py:146

    if self._layer_idx is not None and (
        self._layer_idx == 0 or (self._max_reuse_layer_idx is not None and
                                 self._max_reuse_layer_idx < self._layer_idx)):
      self._reuse_attention = 0
    if attention_initializer:
      self._attention_initializer = tf_keras.initializers.get(
          attention_initializer)
    else:
      self._attention_initializer = tf_utils.clone_initializer(
          self._kernel_initializer)
    self._attention_axes = attention_axes

  def build(self, input_shape):
    if isinstance(input_shape, tf.TensorShape):
      input_tensor_shape = input_shape
    elif isinstance(input_shape, (list, tuple)):
      input_tensor_shape = tf.TensorShape(input_shape[0])
    else:
      raise ValueError(
          "The type of input shape argument is not supported, got: %s" %
          type(input_shape))
    einsum_equation = "abc,cd->abd"
    if len(input_tensor_shape.as_list()) > 3:
      einsum_equation = "...bc,cd->...bd"
    hidden_size = input_tensor_shape[-1]
    if self._head_size is None:
      if hidden_size % self._num_heads != 0:
        raise ValueError(
            "The input size (%d) is not a multiple of the number of attention "
            "heads (%d)" % (hidden_size, self._num_heads))
      self._attention_head_size = int(hidden_size // self._num_heads)
    else:
      self._attention_head_size = self._head_size
    common_kwargs = dict(
        kernel_regularizer=self._kernel_regularizer,
        bias_regularizer=self._bias_regularizer,
        activity_regularizer=self._activity_regularizer,

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/nlp/modeling/layers/reuse_transformer.py:146 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/4407982114d1e9ca. Report an issue: GitHub.