code: def __init__(
      self,
      dim,  # 输入token的dim
      num_heads=8,
      qkv_bias=False,
      qk_scale=None,
      attn_drop_ratio=0.0,
      proj_drop_ratio=0.0,
  ):
      super(Attention, self).__init__()
      self.num_heads = num_heads
      head_dim = dim // num_heads
      self.scale = qk_scale or head_dim**-0.5
      self.qkv = nn.Linear(dim, dim * 3, bias=qkv_bias)
      self.attn_drop = nn.Dropout(attn_drop_ratio)
      self.proj = nn.Linear(dim, dim)
      self.proj_drop = nn.Dropout(proj_drop_ratio)
  
imports: from functools import partial
  from collections import OrderedDict
  import torch
  import torch.nn
label_desc: Use image node_id 1 to create a new Attention object from inherited base classes: nn with example: obj = Attention(dim, num_heads, qkv_bias, qk_scale, attn_drop_ratio, proj_drop_ratio)