code: def __init__(
      self,
      num_pos_feats=128,
      temperature=10000,
      normalize=True,
      scale=2 * math.pi,
      embed_type="sine",
      num_embeddings=50,
      offset=0.0,
      eps=1e-6,
  ):
      super(PositionEmbedding, self).__init__()
      assert embed_type in ["sine", "learned"]
  
      self.embed_type = embed_type
      self.offset = offset
      self.eps = eps
      if self.embed_type == "sine":
          self.num_pos_feats = num_pos_feats
          self.temperature = temperature
          self.normalize = normalize
          self.scale = scale
      elif self.embed_type == "learned":
          self.row_embed = nn.Embedding(num_embeddings, num_pos_feats)
          self.col_embed = nn.Embedding(num_embeddings, num_pos_feats)
      else:
          raise ValueError(f"{self.embed_type} is not supported.")
  
file_path: PaddleDetection/ppdet/modeling/transformers/position_encoding.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import paddle
  import paddle.nn
  from ppdet.core.workspace import register, serializable
label_desc: Use image node_id 1 to create a new PositionEmbedding object from inherited base classes: nn with example: obj = PositionEmbedding(num_pos_feats, temperature, normalize, scale, embed_type, num_embeddings, offset, eps)