code: def __init__(self, dim, heads=8, dropout=0.0):
      super().__init__()
      dim_head = dim // heads
      inner_dim = dim_head * heads
      self.heads = heads
      self.scale = dim_head**-0.5
  
      self.norm = LayerNorm(dim)
      self.attend = nn.Softmax(dim=-1)
      self.dropout = nn.Dropout(dropout)
      self.to_qkv = nn.Conv2d(dim, inner_dim * 3, 1, bias=False)
  
      self.to_out = nn.Sequential(
          nn.Conv2d(inner_dim, dim, 1), nn.Dropout(dropout)
      )
  
imports: from functools import partial
  import torch
  from torch import nn, einsum
  from einops import rearrange
  from einops.layers.torch import Rearrange, Reduce
label_desc: Use image node_id 1 to create a new Attention object from inherited base classes: nn with example: obj = Attention(dim, heads, dropout)