{"record":{"id":"63f082bce77689a2","repo":"tensorflow/models","slug":"attribute-type-head-type-not-supported-63f082","errorCode":null,"errorMessage":"Attribute type {head.type} not supported.","messagePattern":"Attribute type (.+?) not supported\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/tasks/retinanet.py","lineNumber":210,"sourceCode":"        y_true_att = loss_utils.multi_level_flatten(\n            labels['attribute_targets'][head.name], last_dim=None\n        )\n        y_true_att = tf.one_hot(y_true_att, head.size)\n        y_pred_att = loss_utils.multi_level_flatten(\n            outputs['attribute_outputs'][head.name], last_dim=head.size\n        )\n        cls_loss_fn = focal_loss.FocalLoss(\n            alpha=params.losses.focal_loss_alpha,\n            gamma=params.losses.focal_loss_gamma,\n            reduction=tf_keras.losses.Reduction.SUM,\n        )\n        att_loss = cls_loss_fn(\n            y_true=y_true_att,\n            y_pred=y_pred_att,\n            sample_weight=box_sample_weight,\n        )\n      else:\n        raise ValueError(f'Attribute type {head.type} not supported.')\n      attribute_loss += att_loss\n\n    return attribute_loss\n\n  def build_losses(\n      self,\n      outputs: Mapping[str, Any],\n      labels: Mapping[str, Any],\n      aux_losses: Optional[Any] = None,\n  ):\n    \"\"\"Build RetinaNet losses.\"\"\"\n    params = self.task_config\n    attribute_heads = self.task_config.model.head.attribute_heads\n\n    cls_loss_fn = focal_loss.FocalLoss(\n        alpha=params.losses.focal_loss_alpha,\n        gamma=params.losses.focal_loss_gamma,\n        reduction=tf_keras.losses.Reduction.SUM)","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/tasks/retinanet.py#L192-L228","documentation":"Error \"Attribute type {head.type} not supported.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/tasks/retinanet.py:210 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}