tensorflow/models · error · ValueError

Inconsistent decoder type {decoder_type}. Need to be `nasfpn

Error message

Inconsistent decoder type {decoder_type}. Need to be `nasfpn`.

What it means

Error "Inconsistent decoder type {decoder_type}. Need to be `nasfpn`." thrown in tensorflow/models.

Source

Thrown at official/vision/modeling/decoders/nasfpn.py:355

  """Builds NASFPN decoder from a config.

  Args:
    input_specs: A `dict` of input specifications. A dictionary consists of
      {level: TensorShape} from a backbone.
    model_config: A OneOfConfig. Model config.
    l2_regularizer: A `tf_keras.regularizers.Regularizer` instance. Default to
      None.

  Returns:
    A `tf_keras.Model` instance of the NASFPN decoder.

  Raises:
    ValueError: If the model_config.decoder.type is not `nasfpn`.
  """
  decoder_type = model_config.decoder.type
  decoder_cfg = model_config.decoder.get()
  if decoder_type != 'nasfpn':
    raise ValueError(f'Inconsistent decoder type {decoder_type}. '
                     'Need to be `nasfpn`.')

  norm_activation_config = model_config.norm_activation
  return NASFPN(
      input_specs=input_specs,
      min_level=model_config.min_level,
      max_level=model_config.max_level,
      num_filters=decoder_cfg.num_filters,
      num_repeats=decoder_cfg.num_repeats,
      use_separable_conv=decoder_cfg.use_separable_conv,
      activation=norm_activation_config.activation,
      use_sync_bn=norm_activation_config.use_sync_bn,
      norm_momentum=norm_activation_config.norm_momentum,
      norm_epsilon=norm_activation_config.norm_epsilon,
      kernel_regularizer=l2_regularizer)

View on GitHub (pinned to e006f5f0d5)

Solutions

  1. Set the decoder type to 'nasfpn' when building a NASFPN decoder.
  2. Use the matching factory/config class so the decoder type is consistent.

When it happens

Trigger: Thrown at official/vision/modeling/decoders/nasfpn.py:355 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/28f0b358cec83b5f. Report an issue: GitHub.