tensorflow/models · error · ValueError
Unsupported activation
Error message
Unsupported activation `{}`. What it means
Enum guard in the ResNet backbone constructor: the activation argument is neither 'relu' nor 'swish', so the backbone's norm-activation blocks cannot select an activation function. The input at fault is the activation parameter (often mirrored into a norm_activation builder with 'relu').
Solutions
- Pass activation='relu' or 'swish' when constructing the Resnet backbone
- Align the activation value with the norm_activation builder configuration
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/legacy/detection/modeling/architecture/resnet.py:56 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/15bf1c6165442921.
Report an issue: GitHub.
Appendix: source
Thrown at official/legacy/detection/modeling/architecture/resnet.py:56
norm_activation=nn_ops.norm_activation_builder(activation='relu'),
data_format='channels_last'):
"""ResNet initialization function.
Args:
resnet_depth: `int` depth of ResNet backbone model.
activation: the activation function.
norm_activation: an operation that includes a normalization layer followed
by an optional activation layer.
data_format: `str` either "channels_first" for `[batch, channels, height,
width]` or "channels_last for `[batch, height, width, channels]`.
"""
self._resnet_depth = resnet_depth
if activation == 'relu':
self._activation_op = tf.nn.relu
elif activation == 'swish':
self._activation_op = tf.nn.swish
else:
raise ValueError('Unsupported activation `{}`.'.format(activation))
self._norm_activation = norm_activation
self._data_format = data_format
model_params = {
10: {
'block': self.residual_block,
'layers': [1, 1, 1, 1]
},
18: {
'block': self.residual_block,
'layers': [2, 2, 2, 2]
},
34: {
'block': self.residual_block,
'layers': [3, 4, 6, 3]
},
50: {
'block': self.bottleneck_block,View on GitHub (pinned to e006f5f0d5)