code: def attn(q, k, v):
      sim = einsum("b i d, b j d -> b i j", q, k)
      attn_value = sim.softmax(dim=-1)
      out = einsum("b i j, b j d -> b i d", attn_value, v)
      return out
  
imports: from collections import OrderedDict
  from functools import partial
  import torch
  from einops import rearrange, repeat
  from timm.models.layers import DropPath, trunc_normal_
  from torch import einsum, nn
  from towhee.models.layers.mlp import Mlp
  from towhee.models.layers.patch_embed2d import PatchEmbed2D
  from towhee.models.utils.init_vit_weights import init_vit_weights
  import logging
label_desc: Use image node_id 1 for calling a global function with example usage: attn(q, k, v) and returns: out