class_docstr: EVA block w/ post-norm and support for swiglu, MLP norm scale, ROPE. 
class_docstr_tok: ["EVA","block","w\/","post-norm","and","support","for","swiglu",",","MLP","norm","scale",",","ROPE","."]
docstr: Args:
      dim:
      num_heads:
      qkv_bias:
      qkv_fused:
      mlp_ratio:
      swiglu_mlp:
      scale_mlp:
      scale_attn_inner:
      proj_drop:
      attn_drop:
      drop_path:
      init_values:
      act_layer:
      norm_layer:
      attn_head_dim:
code: def __init__(
      self,
      dim: int,
      num_heads: int,
      qkv_bias: bool = True,
      qkv_fused: bool = True,
      mlp_ratio: float = 4.0,
      swiglu_mlp: bool = False,
      scale_mlp: bool = False,
      scale_attn_inner: bool = False,
      proj_drop: float = 0.0,
      attn_drop: float = 0.0,
      drop_path: float = 0.0,
      init_values: Optional[float] = None,  # ignore for post-norm
      act_layer: Callable = nn.GELU,
      norm_layer: Callable = nn.LayerNorm,
      attn_head_dim: Optional[int] = None,
  ):
      """
  
      Args:
          dim:
          num_heads:
          qkv_bias:
          qkv_fused:
          mlp_ratio:
          swiglu_mlp:
          scale_mlp:
          scale_attn_inner:
          proj_drop:
          attn_drop:
          drop_path:
          init_values:
          act_layer:
          norm_layer:
          attn_head_dim:
      """
      super().__init__()
      self.attn = EvaAttention(
          dim,
          num_heads=num_heads,
          qkv_bias=qkv_bias,
          qkv_fused=qkv_fused,
          attn_drop=attn_drop,
          proj_drop=proj_drop,
          attn_head_dim=attn_head_dim,
          norm_layer=norm_layer if scale_attn_inner else None,
      )
      self.norm1 = norm_layer(dim)
      self.drop_path1 = (
          DropPath(drop_path) if drop_path > 0.0 else nn.Identity()
      )
  
      hidden_features = int(dim * mlp_ratio)
      if swiglu_mlp:
          if scale_mlp:
              # when norm in SwiGLU used, an impl with separate fc for gate & x is used
              self.mlp = SwiGLU(
                  in_features=dim,
                  hidden_features=hidden_features,
                  norm_layer=norm_layer if scale_mlp else None,
                  drop=proj_drop,
              )
          else:
              # w/o any extra norm, an impl with packed fc1 weights is used, matches existing GluMLP
              self.mlp = GluMlp(
                  in_features=dim,
                  hidden_features=hidden_features * 2,
                  norm_layer=norm_layer if scale_mlp else None,
                  act_layer=nn.SiLU,
                  gate_last=False,
                  drop=proj_drop,
              )
      else:
          self.mlp = Mlp(
              in_features=dim,
              hidden_features=hidden_features,
              act_layer=act_layer,
              norm_layer=norm_layer if scale_mlp else None,
              drop=proj_drop,
          )
      self.norm2 = norm_layer(dim)
      self.drop_path2 = (
          DropPath(drop_path) if drop_path > 0.0 else nn.Identity()
      )
  
imports: import math
  from typing import Callable, Optional, Tuple, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.utils.checkpoint import checkpoint
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, OPENAI_CLIP_MEAN, OPENAI_CLIP_STD
  from timm.layers import PatchEmbed, Mlp, GluMlp, SwiGLU, LayerNorm, DropPath, PatchDropout, RotaryEmbeddingCat, apply_rot_embed_cat, apply_keep_indices_nlc, trunc_normal_, resample_patch_embed, resample_abs_pos_embed, to_2tuple, use_fused_attn
  from ._builder import build_model_with_cfg
  from ._registry import generate_default_cfgs, register_model
label_desc: Use image node_id 1 to create a new EvaBlockPostNorm object from inherited base classes: nn with example: obj = EvaBlockPostNorm(dim, num_heads, qkv_bias, qkv_fused, mlp_ratio, swiglu_mlp, scale_mlp, scale_attn_inner, proj_drop, attn_drop, drop_path, init_values, act_layer, norm_layer, attn_head_dim)