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/videoglue/modeling/video_action_transformer_model.py:193

@model_factory.register_model_builder('video_action_transformer_model')
def build_video_action_transformer_model(
    input_specs_dict: Mapping[str, tf_keras.layers.InputSpec],
    model_config: cfg.VideoActionTransformerModel,
    num_classes: int,
    l2_regularizer: Optional[tf_keras.regularizers.Regularizer] = None
) -> VideoActionTransformerModel:
  """Builds the video action localziation model."""
  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.head.use_sync_bn):
    raise ValueError('Should use the same batch normalization type.')

  return VideoActionTransformerModel(
      backbone=backbone,
      input_specs=input_specs_dict,
      num_classes=num_classes,
      endpoint_name=model_config.endpoint_name,
      # parameters for classifier
      num_hidden_layers=model_config.head.num_hidden_layers,
      num_hidden_channels=model_config.head.num_hidden_channels,
      use_sync_bn=model_config.head.use_sync_bn,
      activation=model_config.head.activation,
      dropout_rate=model_config.head.dropout_rate,
      crop_size=model_config.head.crop_size,
      sample_offset=model_config.head.sample_offset,
      num_tx_channels=model_config.head.num_tx_channels,
      num_tx_layers=model_config.head.num_tx_layers,
      num_tx_heads=model_config.head.num_tx_heads,
      use_bias=model_config.head.use_bias,

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/videoglue/modeling/video_action_transformer_model.py:193 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/203eb829a8c687f4. Report an issue: GitHub.