class_docstr: ## Batch-Channel Normalization
  
  This first performs a batch normalization - either [normal batch norm](../batch_norm/index.html)
  or a batch norm with
  estimated mean and variance (exponential mean/variance over multiple batches).
  Then a channel normalization performed.
class_docstr_tok: ["#","#","Batch-Channel","Normalization","This","first","performs","a","batch","normalization","-","either","[","normal","batch","norm","]","(","..","\/batch_norm\/index.html",")","or","a","batch","norm","with","estimated","mean","and","variance","(","exponential","mean\/variance","over","multiple","batches",")",".","Then","a","channel","normalization","performed","."]
docstr: * `channels` is the number of features in the input
  * `groups` is the number of groups the features are divided into
  * `eps` is $\epsilon$, used in $\sqrt{Var[x^{(k)}] + \epsilon}$ for numerical stability
  * `momentum` is the momentum in taking the exponential moving average
  * `estimate` is whether to use running mean and variance for batch norm
docstr_tok: ["*","`","channels","`","is","the","number","of","features","in","the","input","*","`","groups","`","is","the","number","of","groups","the","features","are","divided","into","*","`","eps","`","is","$","\\epsilon","$",",","used","in","$","\\sqrt","{","Var","[","x^","{","(","k",")","}","]","+","\\epsilon","}","$","for","numerical","stability","*","`","momentum","`","is","the","momentum","in","taking","the","exponential","moving","average","*","`","estimate","`","is","whether","to","use","running","mean","and","variance","for","batch","norm"]
code: def __init__(
      self,
      channels: int,
      groups: int,
      eps: float = 1e-5,
      momentum: float = 0.1,
      estimate: bool = True,
  ):
      """
      * `channels` is the number of features in the input
      * `groups` is the number of groups the features are divided into
      * `eps` is $\epsilon$, used in $\sqrt{Var[x^{(k)}] + \epsilon}$ for numerical stability
      * `momentum` is the momentum in taking the exponential moving average
      * `estimate` is whether to use running mean and variance for batch norm
      """
      super().__init__()
  
      # Use estimated batch norm or normal batch norm.
      if estimate:
          self.batch_norm = EstimatedBatchNorm(
              channels, eps=eps, momentum=momentum
          )
      else:
          self.batch_norm = BatchNorm(
              channels, eps=eps, momentum=momentum
          )
  
      # Channel normalization
      self.channel_norm = ChannelNorm(channels, groups, eps)
  
file_path: annotated_deep_learning_paper_implementations/labml_nn/normalization/batch_channel_norm/__init__.py
imports: import torch
  from torch import nn
  from labml_helpers.module import Module
  from labml_nn.normalization.batch_norm import BatchNorm
label_desc: Use image node_id 1 to create a new BatchChannelNorm object from inherited base classes: Module with example: obj = BatchChannelNorm(channels, groups, eps, momentum, estimate)