class_docstr: Adds a normalization before computing attention
  
  ..Note: If a list of inputs is passed, all of them get normalized
class_docstr_tok: ["Adds","a","normalization","before","computing","attention","..","Note",":","If","a","list","of","inputs","is","passed",",","all","of","them","get","normalized"]
code: def __init__(
      self,
      d_norm: int,
      sublayer: nn.Module,
      normalization: NormalizationType,
      use_triton: bool = True,
  ):
      super().__init__()
      if (
          _is_triton_available()
          and use_triton
          and normalization == NormalizationType.LayerNorm
      ):
          self.norm: Union[
              nn.LayerNorm, FusedLayerNorm
          ] = FusedLayerNorm(d_norm)
      else:
          self.norm = get_normalization_layer(normalization)(d_norm)
  
      self.sublayer = sublayer
      self.wrap_inputs = isinstance(sublayer, RequiresWrappedInputs)
  
imports: from enum import Enum
  from typing import List, Optional, Tuple, Union
  import torch
  import torch.nn
  from xformers import _is_triton_available
  from collections import namedtuple
label_desc: Use image node_id 1 to create a new PreNorm object from inherited base classes: nn, RequiresWrappedInputs with example: obj = PreNorm(d_norm, sublayer, normalization, use_triton)