code: def flash_attn(self, q, k, v):
      config = self.cuda_config if q.is_cuda else self.cpu_config
  
      # flash attention - https://arxiv.org/abs/2205.14135
  
      with torch.backends.cuda.sdp_kernel(**config._asdict()):
          out = F.scaled_dot_product_attention(q, k, v)
  
      return out
  
imports: from collections import namedtuple
  from packaging import version
  import torch
  import torch.nn.functional
  from torch import nn
  from einops import rearrange
  from einops.layers.torch import Rearrange
label_desc: Use image node_id 2 for calling the Attend obj's underlying member method code with example usage: obj.flash_attn(q, k, v) and returns: out