tensorflow/models · error · ValueError
Attribute head type not supported.
Error message
Attribute head type {} not supported. What it means
Dispatch guard in the QAT dense prediction head's build: attribute heads must be of type 'regression' or 'classification' to pick the predictor conv setup; any other att_type reaches the else branch and raises this ValueError.
Solutions
- Set the attribute head type to 'regression' or 'classification'
- Fix typos in the attribute head config
- Add a build branch for the new attribute head type
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/projects/qat/vision/modeling/heads/dense_prediction_heads.py:268 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/c95ff8e0f66258fa.
Report an issue: GitHub.
Appendix: source
Thrown at official/projects/qat/vision/modeling/heads/dense_prediction_heads.py:268
# Build the final prediction layer.
att_predictor_kwargs = {
'filters':
(att_size * self._config_dict['num_anchors_per_location']),
'kernel_size': 3,
'padding': 'same',
'bias_initializer': tf.zeros_initializer(),
'bias_regularizer': self._config_dict['bias_regularizer'],
}
if att_type == 'regression':
att_predictor_kwargs.update(
{'bias_initializer': tf.zeros_initializer()})
elif att_type == 'classification':
att_predictor_kwargs.update({
'bias_initializer':
tf.constant_initializer(-np.log((1 - 0.01) / 0.01))
})
else:
raise ValueError(
'Attribute head type {} not supported.'.format(att_type))
if not self._config_dict['use_separable_conv']:
att_predictor_kwargs.update({
'kernel_initializer':
tf_keras.initializers.RandomNormal(stddev=1e-5),
'kernel_regularizer':
self._config_dict['kernel_regularizer'],
})
self._att_predictors[att_name] = conv_op(
name='{}_attributes'.format(att_name), **att_predictor_kwargs)
super().build(input_shape)
def call(self, features: Mapping[str, tf.Tensor]):
"""Forward pass of the RetinaNet quantized head.
View on GitHub (pinned to e006f5f0d5)