code: def __init__(
      self,
      dim,
      num_heads=8,
      qkv_bias=False,
      qk_scale=None,
      attn_drop=0.0,
      proj_drop=0.0,
      with_qkv=True,
  ):
      super().__init__()
      self.num_heads = num_heads
      head_dim = dim // num_heads
      self.scale = qk_scale or head_dim**-0.5
      self.with_qkv = with_qkv
      if self.with_qkv:
          self.qkv = nn.Linear(dim, dim * 3, bias=qkv_bias)
          self.proj = nn.Linear(dim, dim)
          self.proj_drop = nn.Dropout(proj_drop)
      self.attn_drop = nn.Dropout(attn_drop)
  
imports: import logging
  from functools import partial
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.utils
  import torch.utils.checkpoint
  from einops import rearrange
  from fairscale.nn.checkpoint.checkpoint_activations import checkpoint_wrapper
  from .helpers import load_pretrained, load_pretrained_imagenet, load_pretrained_kinetics
  from .vit_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, DropPath, to_2tuple, trunc_normal_
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, proj_drop, with_qkv)