class_docstr: Attention module
  Attention module for ViT, here q, k, v are assumed the same.
  The qkv mappings are stored as one single param.
  Attributes:
      num_heads: number of heads
      attn_head_size: feature dim of single head
      all_head_size: feature dim of all heads
      qkv: a nn.Linear for q, k, v mapping
      scales: 1 / sqrt(single_head_feature_dim)
      out: projection of multi-head attention
      attn_dropout: dropout for attention
      proj_dropout: final dropout before output
      softmax: softmax op for attention
code: def forward(self, x):
      qkv = self.qkv(x).chunk(3, axis=-1)
      q, k, v = map(self.transpose_multihead, qkv)
  
      attn = paddle.matmul(q, k, transpose_y=True)
      attn = attn * self.scales
      attn = self.softmax(attn)
      attn = self.attn_dropout(attn)
  
      z = paddle.matmul(attn, v)
      z = z.transpose([0, 2, 1, 3])
      new_shape = z.shape[:-2] + [self.all_head_size]
      z = z.reshape(new_shape)
      # reshape
      z = self.out(z)
      z = self.proj_dropout(z)
      return z
  
imports: import copy
  import paddle
  import paddle.nn
  from disco_diffusion_ernievil_base.vit_b_16x.ernievil2.transformers.droppath import DropPath
label_desc: Use image node_id 4 for calling the Attention obj's underlying member method code with example usage: obj.forward(x) and returns: z