tensorflow/models · error · ValueError

Activation not implemented.

Error message

Activation {} not implemented.

What it means

Enum guard in the ShapeNet/ SpinNet constructor: the activation argument (filled into the message) matched neither 'relu' nor 'swish', so self._activation could not be set for the network's blocks. The input at fault is the activation string in the spinenet params.

Solutions

  1. Set the spinenet activation config to 'relu' or 'swish'
  2. Check for unsupported activation names in the backbone params
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at official/legacy/detection/modeling/architecture/spinenet.py:155 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/91cf8f9e489029fc. Report an issue: GitHub.

Appendix: source

Thrown at official/legacy/detection/modeling/architecture/spinenet.py:155

    self._block_specs = (
        build_block_specs() if block_specs is None else block_specs
    )
    self._endpoints_num_filters = endpoints_num_filters
    self._resample_alpha = resample_alpha
    self._block_repeats = block_repeats
    self._filter_size_scale = filter_size_scale
    self._kernel_initializer = kernel_initializer
    self._kernel_regularizer = kernel_regularizer
    self._bias_regularizer = bias_regularizer
    self._use_sync_bn = use_sync_bn
    self._norm_momentum = norm_momentum
    self._norm_epsilon = norm_epsilon
    if activation == 'relu':
      self._activation = tf.nn.relu
    elif activation == 'swish':
      self._activation = tf.nn.swish
    else:
      raise ValueError('Activation {} not implemented.'.format(activation))
    self._init_block_fn = 'bottleneck'
    self._num_init_blocks = 2

    if use_sync_bn:
      self._norm = layers.experimental.SyncBatchNormalization
    else:
      self._norm = layers.BatchNormalization

    if tf_keras.backend.image_data_format() == 'channels_last':
      self._bn_axis = -1
    else:
      self._bn_axis = 1

    # Build SpineNet.
    inputs = tf_keras.Input(shape=input_specs.shape[1:])

    net = self._build_stem(inputs=inputs)
    net = self._build_scale_permuted_network(

View on GitHub (pinned to e006f5f0d5)