tensorflow/models · error · ValueError
Should use the same batch normalization type.
Error message
Should use the same batch normalization type.
What it means
Error "Should use the same batch normalization type." thrown in tensorflow/models.
Source
Thrown at official/projects/const_cl/modeling/const_cl_model.py:205
@model_factory.register_model_builder('const_cl_model')
def build_const_cl_pretrain_model(
input_specs_dict: Mapping[str, tf_keras.layers.InputSpec],
model_config: const_cl_cfg.ConstCLModel,
num_classes: int,
l2_regularizer: Optional[tf_keras.regularizers.Regularizer] = None
) -> ConstCLModel:
"""Builds the ConST-CL video ssl model."""
del num_classes
backbone = backbones.factory.build_backbone(
input_specs=input_specs_dict['image'],
backbone_config=model_config.backbone,
norm_activation_config=model_config.norm_activation,
l2_regularizer=l2_regularizer)
# Norm layer type in the MLP head should same with backbone
if (model_config.norm_activation.use_sync_bn
!= model_config.global_head.use_sync_bn):
raise ValueError('Should use the same batch normalization type.')
return ConstCLModel(
backbone=backbone,
input_specs=input_specs_dict,
# global_head
num_hidden_channels=model_config.global_head.num_hidden_channels,
num_hidden_layers=model_config.global_head.num_hidden_layers,
num_output_channels=model_config.global_head.num_output_channels,
use_sync_bn=model_config.global_head.use_sync_bn,
norm_momentum=model_config.global_head.norm_momentum,
norm_epsilon=model_config.global_head.norm_epsilon,
activation=model_config.global_head.activation,
normalize_global_features=model_config.global_head.normalize_inputs,
# local_head
context_level=model_config.local_head.context_level,
num_tx_output_channels=model_config.local_head.num_output_channels,
crop_size=model_config.local_head.crop_size,
sample_offset=model_config.local_head.sample_offset,View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/projects/const_cl/modeling/const_cl_model.py:205 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/157d12f8176445d5.
Report an issue: GitHub.