tensorflow/models · error · ValueError
share_classification_heads cannot be set as True when att_pr
Error message
share_classification_heads cannot be set as True when att_prediction_tower_name is specified.
What it means
Error "share_classification_heads cannot be set as True when att_prediction_tower_name is specified." thrown in tensorflow/models.
Source
Thrown at official/vision/modeling/heads/dense_prediction_heads.py:255
)
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 (
att_prediction_tower_name
and self._config_dict['share_classification_heads']
):
raise ValueError(
'share_classification_heads cannot be set as True when'
' att_prediction_tower_name is specified.'
)
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._attribute_kwargs.append(att_predictor_kwargs)
def _apply_prediction_tower(self, features, convs, norms) -> tf.Tensor:
x = features
for conv, norm in zip(convs, norms):
x = conv(x)
x = norm(x)View on GitHub (pinned to e006f5f0d5)
Solutions
- Set share_classification_heads to False when att_prediction_tower_name is specified.
- Remove att_prediction_tower_name if you want to share classification heads across attributes.
When it happens
Trigger: Thrown at official/vision/modeling/heads/dense_prediction_heads.py:255 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/0cf631a00904ee14.
Report an issue: GitHub.