class_docstr: Implements the PETR transformer.
  
  Args:
      as_two_stage (bool): Generate query from encoder features.
          Default: False.
      num_feature_levels (int): Number of feature maps from FPN:
          Default: 4.
      two_stage_num_proposals (int): Number of proposals when set
          `as_two_stage` as True. Default: 300.
class_docstr_tok: ["Implements","the","PETR","transformer",".","Args",":","as_two_stage","(","bool",")",":","Generate","query","from","encoder","features",".","Default",":","False",".","num_feature_levels","(","int",")",":","Number","of","feature","maps","from","FPN",":","Default",":","4.","two_stage_num_proposals","(","int",")",":","Number","of","proposals","when","set","`","as_two_stage","`","as","True",".","Default",":","300","."]
docstr: Get the position embedding of proposal.
docstr_tok: ["Get","the","position","embedding","of","proposal","."]
code: def get_proposal_pos_embed(
      self, proposals, num_pos_feats=128, temperature=10000
  ):
      """Get the position embedding of proposal."""
      scale = 2 * math.pi
      dim_t = paddle.arange(num_pos_feats, dtype="float32")
      dim_t = temperature ** (2 * (dim_t // 2) / num_pos_feats)
      # N, L, 4
      proposals = F.sigmoid(proposals) * scale
      # N, L, 4, 128
      pos = proposals[:, :, :, None] / dim_t
      # N, L, 4, 64, 2
      pos = paddle.stack(
          (pos[:, :, :, 0::2].sin(), pos[:, :, :, 1::2].cos()), axis=4
      ).flatten(2)
      return pos
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle import ParamAttr
  from ppdet.core.workspace import register
  from ..layers import MultiHeadAttention, _convert_attention_mask
  from .utils import _get_clones
  from ..initializer import linear_init_, normal_, constant_, xavier_uniform_
label_desc: Use image node_id 7 for calling the PETRTransformer obj's underlying member method code with example usage: obj.get_proposal_pos_embed(proposals, num_pos_feats, temperature) and returns: pos