code: def __init__(
      self,
      dim,
      num_heads,
      head_dim_ratio=1.0,
      mlp_ratio=4.0,
      proj_drop=0.0,
      attn_drop=0.0,
      drop_path=0.0,
      act_layer=nn.GELU,
      norm_layer=LayerNorm2d,
      group=8,
      attn_disabled=False,
      spatial_conv=False,
  ):
      super().__init__()
      self.spatial_conv = spatial_conv
      self.drop_path = (
          DropPath(drop_path) if drop_path > 0.0 else nn.Identity()
      )
      if attn_disabled:
          self.norm1 = None
          self.attn = None
      else:
          self.norm1 = norm_layer(dim)
          self.attn = Attention(
              dim,
              num_heads=num_heads,
              head_dim_ratio=head_dim_ratio,
              attn_drop=attn_drop,
              proj_drop=proj_drop,
          )
  
      self.norm2 = norm_layer(dim)
      self.mlp = SpatialMlp(
          in_features=dim,
          hidden_features=int(dim * mlp_ratio),
          act_layer=act_layer,
          drop=proj_drop,
          group=group,
          spatial_conv=spatial_conv,
      )
  
imports: import torch
  import torch.nn
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from timm.layers import to_2tuple, trunc_normal_, DropPath, PatchEmbed, LayerNorm2d, create_classifier, use_fused_attn
  from ._builder import build_model_with_cfg
  from ._manipulate import checkpoint_seq
  from ._registry import register_model, generate_default_cfgs
label_desc: Use image node_id 1 to create a new Block object from inherited base classes: nn with example: obj = Block(dim, num_heads, head_dim_ratio, mlp_ratio, proj_drop, attn_drop, drop_path, act_layer, norm_layer, group, attn_disabled, spatial_conv)