{"record":{"id":"5083519069fe0dee","repo":"tensorflow/models","slug":"block-fn-is-not-supported-508351","errorCode":null,"errorMessage":"Block fn `{}` is not supported.","messagePattern":"Block fn `(.+?)` is not supported\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/modeling/backbones/resnet.py","lineNumber":203,"sourceCode":"    self._bn_trainable = bn_trainable\n\n    if tf_keras.backend.image_data_format() == 'channels_last':\n      self._bn_axis = -1\n    else:\n      self._bn_axis = 1\n\n    # Build ResNet.\n    inputs = tf_keras.Input(shape=input_specs.shape[1:])\n    x = self._stem(inputs)\n\n    endpoints = {}\n    for i, spec in enumerate(RESNET_SPECS[model_id]):\n      if spec[0] == 'residual':\n        block_fn = nn_blocks.ResidualBlock\n      elif spec[0] == 'bottleneck':\n        block_fn = nn_blocks.BottleneckBlock\n      else:\n        raise ValueError('Block fn `{}` is not supported.'.format(spec[0]))\n      x = self._block_group(\n          inputs=x,\n          filters=int(spec[1] * self._depth_multiplier),\n          strides=(1 if i == 0 else 2),\n          block_fn=block_fn,\n          block_repeats=spec[2],\n          stochastic_depth_drop_rate=nn_layers.get_stochastic_depth_rate(\n              self._init_stochastic_depth_rate, i + 2, 5),\n          name='block_group_l{}'.format(i + 2))\n      endpoints[str(i + 2)] = x\n\n    self._output_specs = {l: endpoints[l].get_shape() for l in endpoints}\n\n    super(ResNet, self).__init__(inputs=inputs, outputs=endpoints, **kwargs)\n\n  def _stem(self, inputs):\n    stem_depth_multiplier = self._depth_multiplier if self._scale_stem else 1.0\n    if self._stem_type == 'v0':","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/modeling/backbones/resnet.py#L185-L221","documentation":"Error \"Block fn `{}` is not supported.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/modeling/backbones/resnet.py:203 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a supported ResNet block_fn: 'bottleneck' or 'basic'.","Check the block_fn value in the ResNet backbone config 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"}