code: def __init__(
      self,
      dim,
      *,
      dim_context=None,
      causal=False,
      dim_head=64,
      heads=8,
      dropout=0.0,
      use_flash=False,
      cross_attn_include_queries=False,
  ):
      super().__init__()
      self.scale = dim_head**-0.5
      self.heads = heads
      self.cross_attn_include_queries = cross_attn_include_queries
  
      dim_inner = dim_head * heads
      dim_context = default(dim_context, dim)
  
      self.attend = Attend(
          causal=causal, dropout=dropout, use_flash=use_flash
      )
      self.to_q = nn.Linear(dim, dim_inner, bias=False)
      self.to_kv = nn.Linear(dim_context, dim_inner * 2, bias=False)
      self.to_out = nn.Linear(dim_inner, dim, bias=False)
  
imports: from collections import namedtuple
  from functools import wraps
  import torch
  import torch.nn.functional
  from einops import rearrange, repeat
  from einops.layers.torch import Rearrange
  from packaging import version
  from torch import einsum, nn
label_desc: Use image node_id 1 to create a new Attention object from inherited base classes: nn with example: obj = Attention(dim)