class_docstr: Implement domain-specific BatchNorm by cycling.
  
  When a BatchNorm layer is used for multiple input domains or input
  features, it might need to maintain a separate test-time statistics
  for each domain. See Sec 5.2 in :paper:`rethinking-batchnorm`.
  
  This module implements it by using N separate BN layers
  and it cycles through them every time a forward() is called.
  
  NOTE: The caller of this module MUST guarantee to always call
  this module by multiple of N times. Otherwise its test-time statistics
  will be incorrect.
docstr: Args:
      length: number of BatchNorm layers to cycle.
      bn_class: the BatchNorm class to use
      kwargs: arguments of the BatchNorm class, such as num_features.
docstr_tok: ["Args",":","length",":","number","of","BatchNorm","layers","to","cycle",".","bn_class",":","the","BatchNorm","class","to","use","kwargs",":","arguments","of","the","BatchNorm","class",",","such","as","num_features","."]
code: def __init__(self, length: int, bn_class=nn.BatchNorm2d, **kwargs):
      """
      Args:
          length: number of BatchNorm layers to cycle.
          bn_class: the BatchNorm class to use
          kwargs: arguments of the BatchNorm class, such as num_features.
      """
      self._affine = kwargs.pop("affine", True)
      super().__init__(
          [bn_class(**kwargs, affine=False) for k in range(length)]
      )
      if self._affine:
          # shared affine, domain-specific BN
          channels = self[0].num_features
          self.weight = nn.Parameter(torch.ones(channels))
          self.bias = nn.Parameter(torch.zeros(channels))
      self._pos = 0
  
imports: import torch
  import torch.distributed
  from fvcore.nn.distributed import differentiable_all_reduce
  from torch import nn
  from torch.nn import functional
  from detectron2.utils import comm, env
  from .wrappers import BatchNorm2d
label_desc: Use image node_id 1 to create a new CycleBatchNormList object from inherited base classes: nn with example: obj = CycleBatchNormList(length, bn_class)