{"record":{"id":"28f0b358cec83b5f","repo":"tensorflow/models","slug":"inconsistent-decoder-type-decoder-type-need-to-28f0b3","errorCode":null,"errorMessage":"Inconsistent decoder type {decoder_type}. Need to be `nasfpn`.","messagePattern":"Inconsistent decoder type (.+?)\\. Need to be `nasfpn`\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/modeling/decoders/nasfpn.py","lineNumber":355,"sourceCode":"  \"\"\"Builds NASFPN decoder from a config.\n\n  Args:\n    input_specs: A `dict` of input specifications. A dictionary consists of\n      {level: TensorShape} from a backbone.\n    model_config: A OneOfConfig. Model config.\n    l2_regularizer: A `tf_keras.regularizers.Regularizer` instance. Default to\n      None.\n\n  Returns:\n    A `tf_keras.Model` instance of the NASFPN decoder.\n\n  Raises:\n    ValueError: If the model_config.decoder.type is not `nasfpn`.\n  \"\"\"\n  decoder_type = model_config.decoder.type\n  decoder_cfg = model_config.decoder.get()\n  if decoder_type != 'nasfpn':\n    raise ValueError(f'Inconsistent decoder type {decoder_type}. '\n                     'Need to be `nasfpn`.')\n\n  norm_activation_config = model_config.norm_activation\n  return NASFPN(\n      input_specs=input_specs,\n      min_level=model_config.min_level,\n      max_level=model_config.max_level,\n      num_filters=decoder_cfg.num_filters,\n      num_repeats=decoder_cfg.num_repeats,\n      use_separable_conv=decoder_cfg.use_separable_conv,\n      activation=norm_activation_config.activation,\n      use_sync_bn=norm_activation_config.use_sync_bn,\n      norm_momentum=norm_activation_config.norm_momentum,\n      norm_epsilon=norm_activation_config.norm_epsilon,\n      kernel_regularizer=l2_regularizer)\n","sourceCodeStart":337,"sourceCodeEnd":371,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/modeling/decoders/nasfpn.py#L337-L371","documentation":"Error \"Inconsistent decoder type {decoder_type}. Need to be `nasfpn`.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/modeling/decoders/nasfpn.py:355 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the decoder type to 'nasfpn' when building a NASFPN decoder.","Use the matching factory/config class so the decoder type is consistent."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}