class_docstr: This is much like `.vision_transformer.Attention` but uses *localised* self attention by accepting an input with
   an extra "image block" dim
class_docstr_tok: ["This","is","much","like","`",".vision_transformer.Attention","`","but","uses","*","localised","*","self","attention","by","accepting","an","input","with","an","extra","``","image","block","''","dim"]
code: def __init__(
      self,
      dim,
      num_heads=8,
      qkv_bias=False,
      attn_drop=0.0,
      proj_drop=0.0,
  ):
      super().__init__()
      self.num_heads = num_heads
      head_dim = dim // num_heads
      self.scale = head_dim**-0.5
      self.fused_attn = use_fused_attn()
  
      self.qkv = nn.Linear(dim, 3 * dim, 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 collections.abc
  import logging
  import math
  from functools import partial
  import torch
  import torch.nn.functional
  from torch import nn
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from timm.layers import PatchEmbed, Mlp, DropPath, create_classifier, trunc_normal_, _assert
  from timm.layers import create_conv2d, create_pool2d, to_ntuple, use_fused_attn, LayerNorm
  from ._builder import build_model_with_cfg
  from ._features_fx import register_notrace_function
  from ._manipulate import checkpoint_seq, named_apply
  from ._registry import register_model, generate_default_cfgs, register_model_deprecations
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, attn_drop, proj_drop)