class_docstr: This class implements the simplest form of a quaternion batchnorm as
  described in : "Quaternion Convolutional Neural Network for
  Color Image Classification and Forensics", Qilin Y. et al.
  
  Arguments
  ---------
  input_size : int
      Expected size of the dimension to be normalized.
  dim : int, optional
      It defines the axis that should be normalized. It usually correspond to
      the channel dimension (default -1).
  gamma_init : float, optional
      First value of gamma to be used (mean) (default 1.0).
  beta_param : bool, optional
      When set to True the beta parameter of the BN is applied (default True).
  momentum : float, optional
      It defines the momentum as for the real-valued batch-normalization (default 0.1).
  eps : float, optional
      Term used to stabilize operation (default 1e-4).
  track_running_stats : bool, optional
      Equivalent to the real-valued batchnormalization parameter.
      When True, stats are tracked. When False, solely statistics computed
      over the batch are used (default True).
  
  
  Example
  -------
  >>> inp_tensor = torch.rand([10, 40])
  >>> QBN = QBatchNorm(input_size=40)
  >>> out_tensor = QBN(inp_tensor)
  >>> out_tensor.shape
  torch.Size([10, 40])
class_docstr_tok: ["This","class","implements","the","simplest","form","of","a","quaternion","batchnorm","as","described","in",":","``","Quaternion","Convolutional","Neural","Network","for","Color","Image","Classification","and","Forensics","''",",","Qilin","Y.","et","al",".","Arguments","--","--","--","--","-","input_size",":","int","Expected","size","of","the","dimension","to","be","normalized",".","dim",":","int",",","optional","It","defines","the","axis","that","should","be","normalized",".","It","usually","correspond","to","the","channel","dimension","(","default","-1",")",".","gamma_init",":","float",",","optional","First","value","of","gamma","to","be","used","(","mean",")","(","default","1.0",")",".","beta_param",":","bool",",","optional","When","set","to","True","the","beta","parameter","of","the","BN","is","applied","(","default","True",")",".","momentum",":","float",",","optional","It","defines","the","momentum","as","for","the","real-valued","batch-normalization","(","default","0.1",")",".","eps",":","float",",","optional","Term","used","to","stabilize","operation","(","default","1e-4",")",".","track_running_stats",":","bool",",","optional","Equivalent","to","the","real-valued","batchnormalization","parameter",".","When","True",",","stats","are","tracked",".","When","False",",","solely","statistics","computed","over","the","batch","are","used","(","default","True",")",".","Example","--","--","--","-",">",">",">","inp_tensor","=","torch.rand","(","[","10",",","40","]",")",">",">",">","QBN","=","QBatchNorm","(","input_size=40",")",">",">",">","out_tensor","=","QBN","(","inp_tensor",")",">",">",">","out_tensor.shape","torch.Size","(","[","10",",","40","]",")"]
code: def __init__(
      self,
      input_size,
      dim=-1,
      gamma_init=1.0,
      beta_param=True,
      momentum=0.1,
      eps=1e-4,
      track_running_stats=True,
  ):
      super(QBatchNorm, self).__init__()
  
      self.num_features = input_size // 4
      self.gamma_init = gamma_init
      self.beta_param = beta_param
      self.momentum = momentum
      self.dim = dim
      self.eps = eps
      self.track_running_stats = track_running_stats
  
      self.gamma = Parameter(
          torch.full([self.num_features], self.gamma_init)
      )
      self.beta = Parameter(
          torch.zeros(self.num_features * 4),
          requires_grad=self.beta_param,
      )
  
      # instantiate moving statistics
      if track_running_stats:
          self.register_buffer(
              "running_mean", torch.zeros(self.num_features * 4)
          )
          self.register_buffer(
              "running_var", torch.ones(self.num_features)
          )
          self.register_buffer(
              "num_batches_tracked", torch.tensor(0, dtype=torch.long)
          )
      else:
          self.register_parameter("running_mean", None)
          self.register_parameter("running_var", None)
          self.register_parameter("num_batches_tracked", None)
  
imports: import torch
  from torch.nn import Parameter
label_desc: Use image node_id 1 to create a new QBatchNorm object from inherited base classes: torch.nn with example: obj = QBatchNorm(input_size, dim, gamma_init, beta_param, momentum, eps, track_running_stats)