class_docstr: Common base of _InstanceNorm and _BatchNorm.
class_docstr_tok: ["Common","base","of","_InstanceNorm","and","_BatchNorm","."]
code: def __init__(
      self,
      num_features: int,
      eps: float = 1e-5,
      momentum: float = 0.1,
      affine: bool = True,
      track_running_stats: bool = True,
      device=None,
      dtype=None,
  ) -> None:
      factory_kwargs = {"device": device, "dtype": dtype}
      super().__init__()
      self.num_features = num_features
      self.eps = eps
      self.momentum = momentum
      self.affine = affine
      self.track_running_stats = track_running_stats
      if self.affine:
          self.weight = Parameter(
              torch.empty(num_features, **factory_kwargs)
          )
          self.bias = Parameter(
              torch.empty(num_features, **factory_kwargs)
          )
      else:
          self.register_parameter("weight", None)
          self.register_parameter("bias", None)
      if self.track_running_stats:
          self.register_buffer(
              "running_mean",
              torch.zeros(num_features, **factory_kwargs),
          )
          self.register_buffer(
              "running_var", torch.ones(num_features, **factory_kwargs)
          )
          self.running_mean: Optional[Tensor]
          self.running_var: Optional[Tensor]
          self.register_buffer(
              "num_batches_tracked",
              torch.tensor(
                  0,
                  dtype=torch.long,
                  **{
                      k: v
                      for k, v in factory_kwargs.items()
                      if k != "dtype"
                  },
              ),
          )
          self.num_batches_tracked: Optional[Tensor]
      else:
          self.register_buffer("running_mean", None)
          self.register_buffer("running_var", None)
          self.register_buffer("num_batches_tracked", None)
      self.reset_parameters()
  
imports: from typing import Optional, Any
  import torch
  from torch import Tensor
  from torch.nn.parameter import Parameter, UninitializedParameter, UninitializedBuffer
  from ..None import functional
  from ..None import init
  from ._functions import SyncBatchNorm
  from .lazy import LazyModuleMixin
  from .module import Module
label_desc: Use image node_id 1 to create a new _NormBase object from inherited base classes: Module with example: obj = _NormBase(num_features, eps, momentum, affine, track_running_stats, device, dtype)