tensorflow/models · error · ValueError
The inner_dim of f{self.__class__} must be an even integer.
Error message
The inner_dim of f{self.__class__} must be an even integer. However, inner_dim is f{inner_dim} What it means
Error "The inner_dim of f{self.__class__} must be an even integer. However, inner_dim is f{inner_dim}" thrown in tensorflow/models.
Source
Thrown at official/projects/roformer/roformer_encoder_block.py:88
norm_first: Whether to normalize inputs to attention and intermediate
dense layers. If set False, output of attention and intermediate dense
layers is normalized.
norm_epsilon: Epsilon value to initialize normalization layers.
output_dropout: Dropout probability for the post-attention and output
dropout.
attention_dropout: Dropout probability for within the attention layer.
inner_dropout: Dropout probability for the first Dense layer in a
two-layer feedforward network.
attention_initializer: Initializer for kernels of attention layers. If set
`None`, attention layers use kernel_initializer as initializer for
kernel.
attention_axes: axes over which the attention is applied. `None` means
attention over all axes, but batch, heads, and features.
**kwargs: keyword arguments.
"""
super().__init__(**kwargs)
if inner_dim % 2 != 0:
raise ValueError(f"The inner_dim of f{self.__class__} must be an even "
f"integer. However, inner_dim is f{inner_dim}")
self._num_heads = num_attention_heads
self._inner_dim = inner_dim
self._inner_activation = inner_activation
self._attention_dropout = attention_dropout
self._attention_dropout_rate = attention_dropout
self._output_dropout = output_dropout
self._output_dropout_rate = output_dropout
self._output_range = output_range
self._kernel_initializer = tf_keras.initializers.get(kernel_initializer)
self._bias_initializer = tf_keras.initializers.get(bias_initializer)
self._kernel_regularizer = tf_keras.regularizers.get(kernel_regularizer)
self._bias_regularizer = tf_keras.regularizers.get(bias_regularizer)
self._activity_regularizer = tf_keras.regularizers.get(activity_regularizer)
self._kernel_constraint = tf_keras.constraints.get(kernel_constraint)
self._bias_constraint = tf_keras.constraints.get(bias_constraint)
self._use_bias = use_bias
self._norm_first = norm_firstView on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/projects/roformer/roformer_encoder_block.py:88 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/f5d2a265e0661058.
Report an issue: GitHub.