tensorflow/models · error · ValueError
Attribute type {head.type} not supported.
Error message
Attribute type {head.type} not supported. What it means
Error "Attribute type {head.type} not supported." thrown in tensorflow/models.
Source
Thrown at official/vision/tasks/retinanet.py:210
y_true_att = loss_utils.multi_level_flatten(
labels['attribute_targets'][head.name], last_dim=None
)
y_true_att = tf.one_hot(y_true_att, head.size)
y_pred_att = loss_utils.multi_level_flatten(
outputs['attribute_outputs'][head.name], last_dim=head.size
)
cls_loss_fn = focal_loss.FocalLoss(
alpha=params.losses.focal_loss_alpha,
gamma=params.losses.focal_loss_gamma,
reduction=tf_keras.losses.Reduction.SUM,
)
att_loss = cls_loss_fn(
y_true=y_true_att,
y_pred=y_pred_att,
sample_weight=box_sample_weight,
)
else:
raise ValueError(f'Attribute type {head.type} not supported.')
attribute_loss += att_loss
return attribute_loss
def build_losses(
self,
outputs: Mapping[str, Any],
labels: Mapping[str, Any],
aux_losses: Optional[Any] = None,
):
"""Build RetinaNet losses."""
params = self.task_config
attribute_heads = self.task_config.model.head.attribute_heads
cls_loss_fn = focal_loss.FocalLoss(
alpha=params.losses.focal_loss_alpha,
gamma=params.losses.focal_loss_gamma,
reduction=tf_keras.losses.Reduction.SUM)View on GitHub (pinned to e006f5f0d5)
Solutions
- Use a supported attribute head type (e.g. 'classification' or 'regression') in the RetinaNet task config.
- Check the attribute head 'type' field for typos.
When it happens
Trigger: Thrown at official/vision/tasks/retinanet.py:210 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/63f082bce77689a2.
Report an issue: GitHub.