code: def __init__(
      self,
      d,
      transposed=False,  # Length dimension is -1 or -2
      _name_="layer",
      **kwargs,
  ):
      super().__init__()
      self.transposed = transposed
      self._name_ = _name_
  
      if _name_ == "layer":
          self.channel = True  # Normalize over channel dimension
          if self.transposed:
              self.norm = TransposedLN(d, **kwargs)
          else:
              self.norm = nn.LayerNorm(d, **kwargs)
      elif _name_ == "instance":
          self.channel = False
          norm_args = {"affine": False, "track_running_stats": False}
          norm_args.update(kwargs)
          self.norm = nn.InstanceNorm1d(
              d, **norm_args
          )  # (True, True) performs very poorly
      elif _name_ == "batch":
          self.channel = False
          norm_args = {"affine": True, "track_running_stats": True}
          norm_args.update(kwargs)
          self.norm = nn.BatchNorm1d(d, **norm_args)
      elif _name_ == "group":
          self.channel = False
          self.norm = nn.GroupNorm(1, d, *kwargs)
      elif _name_ == "none":
          self.channel = True
          self.norm = nn.Identity()
      else:
          raise NotImplementedError
  
imports: import math
  from functools import partial
  import torch
  import torch.nn
  import torch.nn.functional
  from einops import rearrange
  from opt_einsum import contract
label_desc: Use image node_id 1 to create a new Normalization object from inherited base classes: nn with example: obj = Normalization(d, transposed, _name_)