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: Initialize layers of the DeformableDetrTransformer.
docstr_tok: ["Initialize","layers","of","the","DeformableDetrTransformer","."]
code: def init_layers(self):
      """Initialize layers of the DeformableDetrTransformer."""
      # paddle.create_parameter
      self.level_embeds = paddle.create_parameter(
          (self.num_feature_levels, self.embed_dims), dtype="float32"
      )
  
      if self.as_two_stage:
          self.enc_output = nn.Linear(self.embed_dims, self.embed_dims)
          self.enc_output_norm = nn.LayerNorm(self.embed_dims)
          self.refine_query_embedding = nn.Embedding(
              self.num_keypoints, self.embed_dims * 2
          )
      else:
          self.reference_points = nn.Linear(
              self.embed_dims, 2 * self.num_keypoints
          )
  
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 2 for calling the PETRTransformer obj's underlying member method code with example usage: obj.init_layers() without return types