{"record":{"id":"157d12f8176445d5","repo":"tensorflow/models","slug":"should-use-the-same-batch-normalization-type","errorCode":null,"errorMessage":"Should use the same batch normalization type.","messagePattern":"Should use the same batch normalization type\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/const_cl/modeling/const_cl_model.py","lineNumber":205,"sourceCode":"@model_factory.register_model_builder('const_cl_model')\ndef build_const_cl_pretrain_model(\n    input_specs_dict: Mapping[str, tf_keras.layers.InputSpec],\n    model_config: const_cl_cfg.ConstCLModel,\n    num_classes: int,\n    l2_regularizer: Optional[tf_keras.regularizers.Regularizer] = None\n) -> ConstCLModel:\n  \"\"\"Builds the ConST-CL video ssl model.\"\"\"\n  del num_classes\n  backbone = backbones.factory.build_backbone(\n      input_specs=input_specs_dict['image'],\n      backbone_config=model_config.backbone,\n      norm_activation_config=model_config.norm_activation,\n      l2_regularizer=l2_regularizer)\n\n  # Norm layer type in the MLP head should same with backbone\n  if (model_config.norm_activation.use_sync_bn\n      != model_config.global_head.use_sync_bn):\n    raise ValueError('Should use the same batch normalization type.')\n\n  return ConstCLModel(\n      backbone=backbone,\n      input_specs=input_specs_dict,\n      # global_head\n      num_hidden_channels=model_config.global_head.num_hidden_channels,\n      num_hidden_layers=model_config.global_head.num_hidden_layers,\n      num_output_channels=model_config.global_head.num_output_channels,\n      use_sync_bn=model_config.global_head.use_sync_bn,\n      norm_momentum=model_config.global_head.norm_momentum,\n      norm_epsilon=model_config.global_head.norm_epsilon,\n      activation=model_config.global_head.activation,\n      normalize_global_features=model_config.global_head.normalize_inputs,\n      # local_head\n      context_level=model_config.local_head.context_level,\n      num_tx_output_channels=model_config.local_head.num_output_channels,\n      crop_size=model_config.local_head.crop_size,\n      sample_offset=model_config.local_head.sample_offset,","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/const_cl/modeling/const_cl_model.py#L187-L223","documentation":"Error \"Should use the same batch normalization type.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/const_cl/modeling/const_cl_model.py:205 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"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"}