code: def xformers_attnblock_forward(self, x):
      try:
          h_ = x
          h_ = self.norm(h_)
          q = self.q(h_)
          k = self.k(h_)
          v = self.v(h_)
          b, c, h, w = q.shape
          q, k, v = (
              rearrange(t, "b c h w -> b (h w) c") for t in (q, k, v)
          )
          dtype = q.dtype
          if shared.opts.upcast_attn:
              q, k = q.float(), k.float()
          q = q.contiguous()
          k = k.contiguous()
          v = v.contiguous()
          out = xformers.ops.memory_efficient_attention(
              q, k, v, op=get_xformers_flash_attention_op(q, k, v)
          )
          out = out.to(dtype)
          out = rearrange(out, "b (h w) c -> b c h w", h=h)
          out = self.proj_out(out)
          return x + out
      except NotImplementedError:
          return cross_attention_attnblock_forward(self, x)
  
imports: from __future__ import annotations
  import math
  import psutil
  import platform
  import torch
  from torch import einsum
  from ldm.util import default
  from einops import rearrange
  from modules import shared, errors, devices, sub_quadratic_attention
  from modules.hypernetworks import hypernetwork
  import ldm.modules.attention
  import ldm.modules.diffusionmodules.model
  import sgm.modules.attention
  import sgm.modules.diffusionmodules.model
label_desc: Use image node_id 21 for calling a global function with example usage: xformers_attnblock_forward(x) and returns: unknown, cross_attention_attnblock_forward