class_docstr: This code is based on
  https://github.com/facebookresearch/detr/blob/main/models/segmentation.py
  
  This is a 2D attention module, which only returns the attention softmax (no multiplication by value)
class_docstr_tok: ["This","code","is","based","on","https",":","\/\/github.com\/facebookresearch\/detr\/blob\/main\/models\/segmentation.py","This","is","a","2D","attention","module",",","which","only","returns","the","attention","softmax","(","no","multiplication","by","value",")"]
code: def __init__(
      self, query_dim, hidden_dim, num_heads, dropout=0.0, bias=True
  ):
      super().__init__()
      self.num_heads = num_heads
      self.hidden_dim = hidden_dim
      self.dropout = nn.Dropout(dropout)
  
      weight_attr = paddle.ParamAttr(
          initializer=paddle.nn.initializer.XavierUniform()
      )
      bias_attr = (
          paddle.framework.ParamAttr(
              initializer=paddle.nn.initializer.Constant()
          )
          if bias
          else False
      )
  
      self.q_proj = nn.Linear(
          query_dim, hidden_dim, weight_attr, bias_attr
      )
      self.k_proj = nn.Conv2D(
          query_dim,
          hidden_dim,
          1,
          weight_attr=weight_attr,
          bias_attr=bias_attr,
      )
  
      self.normalize_fact = float(hidden_dim / self.num_heads) ** -0.5
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from ppdet.core.workspace import register
  import pycocotools.mask
  from ..initializer import linear_init_, constant_
  from ..transformers.utils import inverse_sigmoid
label_desc: Use image node_id 1 to create a new MultiHeadAttentionMap object from inherited base classes: nn with example: obj = MultiHeadAttentionMap(query_dim, hidden_dim, num_heads, dropout, bias)