code: def __init__(
      self,
      dim: int,
      num_heads: int,
      window_size: Tuple[int, int],
      use_global: bool = True,
      qkv_bias: bool = True,
      attn_drop: float = 0.0,
      proj_drop: float = 0.0,
  ):
      super().__init__()
      window_size = to_2tuple(window_size)
      self.window_size = window_size
      self.num_heads = num_heads
      self.head_dim = dim // num_heads
      self.scale = self.head_dim**-0.5
      self.use_global = use_global
  
      self.rel_pos = RelPosBias(
          window_size=window_size, num_heads=num_heads
      )
      if self.use_global:
          self.qkv = nn.Linear(dim, dim * 2, bias=qkv_bias)
      else:
          self.qkv = nn.Linear(dim, dim * 3, bias=qkv_bias)
      self.attn_drop = nn.Dropout(attn_drop)
      self.proj = nn.Linear(dim, dim)
      self.proj_drop = nn.Dropout(proj_drop)
  
imports: import math
  from functools import partial
  from typing import Callable, List, Optional, Tuple, Union
  import torch
  import torch.nn
  import torch.utils.checkpoint
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from timm.layers import DropPath, to_2tuple, to_ntuple, Mlp, ClassifierHead, LayerNorm2d, get_attn, get_act_layer, get_norm_layer, RelPosBias, _assert
  from ._builder import build_model_with_cfg
  from ._features_fx import register_notrace_function
  from ._manipulate import named_apply
  from ._registry import register_model, generate_default_cfgs
label_desc: Use image node_id 1 to create a new WindowAttentionGlobal object from inherited base classes: nn with example: obj = WindowAttentionGlobal(dim, num_heads, window_size, use_global, qkv_bias, attn_drop, proj_drop)