{"record":{"id":"10c203f8a8253413","repo":"tensorflow/models","slug":"the-resnet-depth-should-be-in-s-not-a-valid-re","errorCode":null,"errorMessage":"The resnet_depth should be in [%s]. Not a valid resnet_depth:","messagePattern":"The resnet_depth should be in \\[(.+?)\\]\\. Not a valid resnet_depth:","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/legacy/detection/modeling/architecture/resnet.py","lineNumber":94,"sourceCode":"        },\n        101: {\n            'block': self.bottleneck_block,\n            'layers': [3, 4, 23, 3]\n        },\n        152: {\n            'block': self.bottleneck_block,\n            'layers': [3, 8, 36, 3]\n        },\n        200: {\n            'block': self.bottleneck_block,\n            'layers': [3, 24, 36, 3]\n        }\n    }\n\n    if resnet_depth not in model_params:\n      valid_resnet_depths = ', '.join(\n          [str(depth) for depth in sorted(model_params.keys())])\n      raise ValueError(\n          'The resnet_depth should be in [%s]. Not a valid resnet_depth:' %\n          (valid_resnet_depths), self._resnet_depth)\n    params = model_params[resnet_depth]\n    self._resnet_fn = self.resnet_v1_generator(params['block'],\n                                               params['layers'])\n\n  def __call__(self, inputs, is_training=None):\n    \"\"\"Returns the ResNet model for a given size and number of output classes.\n\n    Args:\n      inputs: a `Tesnor` with shape [batch_size, height, width, 3] representing\n        a batch of images.\n      is_training: `bool` if True, the model is in training mode.\n\n    Returns:\n      a `dict` containing `int` keys for continuous feature levels [2, 3, 4, 5].\n      The values are corresponding feature hierarchy in ResNet with shape\n      [batch_size, height_l, width_l, num_filters].","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/legacy/detection/modeling/architecture/resnet.py#L76-L112","documentation":"Validation in the ResNet constructor: resnet_depth is not a key of the hardcoded depth-to-block-layout table (18, 34, 50, 101, 152, 200, ...), so the number of residual blocks per stage cannot be determined. The message lists the valid depths it computed from that table.","triggerScenarios":"Thrown at official/legacy/detection/modeling/architecture/resnet.py:94 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the supported depths, e.g. resnet_depth=50 or 101","Correct the resnet_depth value in the backbone config"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}