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/transformer_encoder_block.py:293
self._kernel_initializer
)
self._attention_axes = attention_axes
if self._diff_q_kv_att_layer_norm and not self._norm_first:
raise ValueError(
"Setting `diff_q_and_kv_attention_layer_norm` to True"
"when `norm_first` is False is invalid."
)
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])
elif isinstance(input_shape, dict):
input_tensor_shape = tf.TensorShape(input_shape["input_tensor"])
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 hidden_size % self._num_heads != 0:
logging.warning(
"The input size (%d) is not a multiple of the number of attention "
"heads (%d)", hidden_size, self._num_heads)
if self._key_dim is None:
self._key_dim = int(hidden_size // self._num_heads)
if self._output_last_dim is None:
last_output_shape = hidden_size
else:
last_output_shape = self._output_last_dim
attention_layer_kwargs = dict(View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/nlp/modeling/layers/transformer_encoder_block.py:293 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/2739027f63123c03.
Report an issue: GitHub.