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/vision/modeling/backbones/resnet_unet.py:397
x)
x = self._norm(
axis=bn_axis,
momentum=norm_momentum,
epsilon=norm_epsilon,
trainable=bn_trainable)(
x)
x = tf_utils.get_activation(activation, use_keras_layer=True)(x)
else:
x = layers.MaxPool2D(pool_size=3, strides=2, padding='same')(x)
endpoints = {}
for i, spec in enumerate(RESNET_SPECS[model_id]):
if spec[0] == 'residual':
block_fn = nn_blocks.ResidualBlock
elif spec[0] == 'bottleneck':
block_fn = nn_blocks.BottleneckBlock
else:
raise ValueError('Block fn `{}` is not supported.'.format(spec[0]))
x = self._block_group(
inputs=x,
filters=int(spec[1] * self._depth_multiplier),
strides=(1 if i == 0 else 2),
block_fn=block_fn,
block_repeats=spec[2],
stochastic_depth_drop_rate=nn_layers.get_stochastic_depth_rate(
self._init_stochastic_depth_rate, i + 2, 8),
name='block_group_l{}'.format(i + 2))
endpoints[str(i + 2)] = x
norm_layer = lambda: tf_keras.layers.LayerNormalization(epsilon=1e-6)
for i in range(len(upsample_filters)): # pyrefly: ignore[bad-argument-type]
backbone_feature = layers.Conv2D(
filters=int(upsample_filters[i] * stem_depth_multiplier), # pyrefly: ignore[unsupported-operation]
kernel_size=1,
strides=1,
use_bias=False,View on GitHub (pinned to e006f5f0d5)
Solutions
- Use a supported block_fn: 'bottleneck' or 'basic'.
- Check the block_fn value in the backbone config for typos.
When it happens
Trigger: Thrown at official/vision/modeling/backbones/resnet_unet.py:397 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/75ae961f327bc7c4.
Report an issue: GitHub.