{"record":{"id":"101c854ac84af493","repo":"tensorflow/models","slug":"attribute-head-name-not-found-in-model-outputs","errorCode":null,"errorMessage":"Attribute {head.name} not found in model outputs.","messagePattern":"Attribute (.+?) not found in model outputs\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/tasks/retinanet.py","lineNumber":176,"sourceCode":"                           box_sample_weight: tf.Tensor) -> float:\n    \"\"\"Computes attribute loss.\n\n    Args:\n      attribute_heads: a list of attribute head configs.\n      outputs: RetinaNet model outputs.\n      labels: RetinaNet labels.\n      box_sample_weight: normalized bounding box sample weights.\n\n    Returns:\n      Attribute loss of all attribute heads.\n    \"\"\"\n    params = self.task_config\n    attribute_loss = 0.0\n    for head in attribute_heads:\n      if head.name not in labels['attribute_targets']:\n        raise ValueError(f'Attribute {head.name} not found in label targets.')\n      if head.name not in outputs['attribute_outputs']:\n        raise ValueError(f'Attribute {head.name} not found in model outputs.')\n\n      if head.type == 'regression':\n        y_true_att = loss_utils.multi_level_flatten(\n            labels['attribute_targets'][head.name], last_dim=head.size\n        )\n        y_pred_att = loss_utils.multi_level_flatten(\n            outputs['attribute_outputs'][head.name], last_dim=head.size\n        )\n        att_loss_fn = tf_keras.losses.Huber(\n            1.0, reduction=tf_keras.losses.Reduction.SUM)\n        att_loss = att_loss_fn(\n            y_true=y_true_att,\n            y_pred=y_pred_att,\n            sample_weight=box_sample_weight)\n      elif head.type == 'classification':\n        y_true_att = loss_utils.multi_level_flatten(\n            labels['attribute_targets'][head.name], last_dim=None\n        )","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/tasks/retinanet.py#L158-L194","documentation":"Error \"Attribute {head.name} not found in model outputs.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/tasks/retinanet.py:176 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the model outputs contain the attribute head's outputs keyed by head.name.","Add the missing attribute head to the model or fix the head name in the config."],"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"}