{"record":{"id":"da9c7f16f6b71d58","repo":"tensorflow/models","slug":"the-structure-of-anchor-sizes-must-be-a-tuple-l","errorCode":null,"errorMessage":"the structure of `anchor_sizes` must be a tuple, list, or dict, given {}","messagePattern":"the structure of `anchor_sizes` must be a tuple, list, or dict, given (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/ops/anchor_generator.py","lineNumber":179,"sourceCode":"        self.anchor_generators.append(\n            _SingleAnchorGenerator(anchor_size, scale_list, ar_list, stride,\n                                   clip_boxes))\n\n  def __call__(self, image_size):\n    anchor_generators = tf.nest.flatten(self.anchor_generators)\n    results = [anchor_gen(image_size) for anchor_gen in anchor_generators]\n    return tf.nest.pack_sequence_as(self.anchor_generators, results)\n\n\ndef maybe_map_structure_for_anchor(params, anchor_sizes):\n  \"\"\"broadcast the params to match anchor_sizes.\"\"\"\n  if all(isinstance(param, (int, float)) for param in params):\n    if isinstance(anchor_sizes, (tuple, list)):\n      return [params] * len(anchor_sizes)\n    elif isinstance(anchor_sizes, dict):\n      return tf.nest.map_structure(lambda _: params, anchor_sizes)\n    else:\n      raise ValueError(\"the structure of `anchor_sizes` must be a tuple, \"\n                       \"list, or dict, given {}\".format(anchor_sizes))\n  else:\n    return params\n","sourceCodeStart":161,"sourceCodeEnd":183,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/ops/anchor_generator.py#L161-L183","documentation":"Error \"the structure of `anchor_sizes` must be a tuple, list, or dict, given {}\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/ops/anchor_generator.py:179 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass anchor_sizes as a tuple, list, or dict of level -> sizes.","Wrap a single size in a list or map it per feature level in a dict."],"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"}