tensorflow/models · error · ValueError

Block fn `{}` is not supported.

Error message

Block fn `{}` is not supported.

What it means

Error "Block fn `{}` is not supported." thrown in tensorflow/models.

Source

Thrown at official/projects/const_cl/modeling/backbones/resnet_3d.py:153

    temporal_kernel_size = 1 if self._stem_pool_temporal_stride == 1 else 3
    self._max_pool = layers.MaxPool3D(
        pool_size=[temporal_kernel_size, 3, 3],
        strides=[self._stem_pool_temporal_stride, 2, 2],
        padding='same')

    # Build intermediate blocks and endpoints.
    resnet_specs = RESNET_SPECS[self._model_id]
    if len(self._temporal_strides) != len(resnet_specs) or len(
        self._temporal_kernel_sizes) != len(resnet_specs):
      raise ValueError(
          'Number of blocks in temporal specs should equal to resnet_specs.')

    self._blocks = {}
    for i, resnet_spec in enumerate(resnet_specs):
      if resnet_spec[0] == 'bottleneck3d':
        block_fn = nn_blocks_3d.BottleneckBlock3D
      else:
        raise ValueError('Block fn `{}` is not supported.'.format(
            resnet_spec[0]))

      use_self_gating = (
          self._use_self_gating[i] if self._use_self_gating else False)
      self._blocks[f'res_{i+2}'] = self._build_block_group(
          inputs=inputs,
          filters=resnet_spec[1],
          temporal_kernel_sizes=self._temporal_kernel_sizes[i],
          temporal_strides=self._temporal_strides[i],
          spatial_strides=(1 if i == 0 else 2),
          block_fn=block_fn,
          block_repeats=resnet_spec[2],
          stochastic_depth_drop_rate=nn_layers.get_stochastic_depth_rate(
              self._init_stochastic_depth_rate, i + 2, 5),
          use_self_gating=use_self_gating,  # pyrefly: ignore[bad-argument-type]
          name='res_{}'.format(i + 2))

    # Duplicate res5 block.

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/const_cl/modeling/backbones/resnet_3d.py:153 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24). Data as JSON: /api/errors/d88245905fd42577. Report an issue: GitHub.