class_docstr: A module which performs QKV attention. Matches legacy QKVAttention + input/ouput heads shaping
class_docstr_tok: ["A","module","which","performs","QKV","attention",".","Matches","legacy","QKVAttention","+","input\/ouput","heads","shaping"]
code: def count_flops(model, _x, y):
      return count_flops_attn(model, _x, y)
  
imports: import math
  from abc import abstractmethod
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from ldm.modules.attention import SpatialTransformer
  from ldm.modules.diffusionmodules.util import avg_pool_nd, checkpoint, conv_nd, linear, normalization, timestep_embedding, zero_module
  from ldm.util import exists
label_desc: Use image node_id 3 for calling the QKVAttentionLegacy obj's underlying member method code with example usage: obj.count_flops(model, _x, y) and returns: count_flops_attn