code: def validate(module: BATCHNORM) -> List[UnsupportedModuleError]:
      return [
          ShouldReplaceModuleError(
              "BatchNorm cannot support training with differential privacy. "
              "The reason for it is that BatchNorm makes each sample's normalized value "
              "depend on its peers in a batch, ie the same sample x will get normalized to "
              "a different value depending on who else is on its batch. "
              "Privacy-wise, this means that we would have to put a privacy mechanism there too. "
              "While it can in principle be done, there are now multiple normalization layers that "
              "do not have this issue: LayerNorm, InstanceNorm and their generalization GroupNorm "
              "are all privacy-safe since they don't have this property."
              "We offer utilities to automatically replace BatchNorms to GroupNorms and we will "
              "release pretrained models to help transition, such as GN-ResNet ie a ResNet using "
              "GroupNorm, pretrained on ImageNet"
          )
      ]
  
file_path: opacus/opacus/validators/batch_norm.py
imports: import logging
  import math
  from typing import List, Optional, Union
  import torch.nn
  from .errors import ShouldReplaceModuleError, UnsupportableModuleError, UnsupportedModuleError
  from .utils import register_module_fixer, register_module_validator
label_desc: Use image node_id 1 for calling a global function with example usage: validate(module) and returns: list