tensorflow/models · error · ValueError

Unsupported act_fn %s.

Error message

Unsupported act_fn %s.

What it means

Error "Unsupported act_fn %s." thrown in tensorflow/models.

Source

Thrown at official/projects/maxvit/modeling/common_ops.py:69

            1
            + tf.tanh(
                np.sqrt(2 / np.pi) * (features + 0.044715 * tf.pow(features, 3))
            )
        )
    )
  else:
    raise ValueError('Unsupported act_fn {}'.format(act_fn))


def get_act_fn(act_fn):
  if act_fn is None:
    act_fn = 'gelu'
  if isinstance(act_fn, str):
    return functools.partial(activation_fn, act_fn=act_fn)
  elif callable(act_fn):
    return act_fn
  else:
    raise ValueError('Unsupported act_fn %s.' % act_fn)


def pooling_2d(inputs, pool_type, stride, **kwargs):
  """Perform 2D pooling."""
  if stride > 1:
    if pool_type == 'max':
      pool_op = tf_keras.layers.MaxPool2D
    elif pool_type == 'avg':
      pool_op = tf_keras.layers.AveragePooling2D
    else:
      raise ValueError('Unsurpported pool_type %s' % pool_type)
    output = pool_op(
        pool_size=(stride, stride), strides=(stride, stride), **kwargs
    )(inputs)
  else:
    output = inputs
  return output

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/maxvit/modeling/common_ops.py:69 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/1d0d1200c089c713. Report an issue: GitHub.