code: def __init__(
      self,
      dim,
      num_heads,
      mlp_ratio=4.0,
      proj_drop=0.0,
      attn_drop=0.0,
      drop_path=0.0,
      act_layer=nn.GELU,
      norm_layer=nn.LayerNorm,
      sr_ratio=1,
      ws=None,
  ):
      super().__init__()
      self.norm1 = norm_layer(dim)
      if ws is None:
          self.attn = Attention(
              dim, num_heads, False, None, attn_drop, proj_drop
          )
      elif ws == 1:
          self.attn = GlobalSubSampleAttn(
              dim, num_heads, attn_drop, proj_drop, sr_ratio
          )
      else:
          self.attn = LocallyGroupedAttn(
              dim, num_heads, attn_drop, proj_drop, ws
          )
      self.drop_path1 = (
          DropPath(drop_path) if drop_path > 0.0 else nn.Identity()
      )
  
      self.norm2 = norm_layer(dim)
      self.mlp = Mlp(
          in_features=dim,
          hidden_features=int(dim * mlp_ratio),
          act_layer=act_layer,
          drop=proj_drop,
      )
      self.drop_path2 = (
          DropPath(drop_path) if drop_path > 0.0 else nn.Identity()
      )
  
imports: import math
  from functools import partial
  from typing import Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from timm.layers import Mlp, DropPath, to_2tuple, trunc_normal_, use_fused_attn
  from ._builder import build_model_with_cfg
  from ._features_fx import register_notrace_module
  from ._registry import register_model, generate_default_cfgs
  from .vision_transformer import Attention
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, mlp_ratio, proj_drop, attn_drop, drop_path, act_layer, norm_layer, sr_ratio, ws)