code: def build_2d_sincos_position_embedding(
      w, h, embed_dim=256, temperature=10000.0
  ):
      grid_w = paddle.arange(int(w), dtype=paddle.float32)
      grid_h = paddle.arange(int(h), dtype=paddle.float32)
      grid_w, grid_h = paddle.meshgrid(grid_w, grid_h)
      assert (
          embed_dim % 4 == 0
      ), "Embed dimension must be divisible by 4 for 2D sin-cos position embedding"
      pos_dim = embed_dim // 4
      omega = paddle.arange(pos_dim, dtype=paddle.float32) / pos_dim
      omega = 1.0 / (temperature**omega)
  
      out_w = grid_w.flatten()[..., None] @ omega[None]
      out_h = grid_h.flatten()[..., None] @ omega[None]
  
      return paddle.concat(
          [
              paddle.sin(out_w),
              paddle.cos(out_w),
              paddle.sin(out_h),
              paddle.cos(out_h),
          ],
          axis=1,
      )[None, :, :]
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  from ppdet.core.workspace import register, serializable
  from ppdet.modeling.ops import get_act_fn
  from ..shape_spec import ShapeSpec
  from ..backbones.csp_darknet import BaseConv
  from ..backbones.cspresnet import RepVggBlock
  from ppdet.modeling.transformers.detr_transformer import TransformerEncoder
  from ..initializer import xavier_uniform_, linear_init_
  from ..layers import MultiHeadAttention
  from paddle import ParamAttr
  from paddle.regularizer import L2Decay
label_desc: Use image node_id 3 for calling the HybridEncoder obj's underlying member method code with example usage: obj.build_2d_sincos_position_embedding(w, h, embed_dim, temperature) and returns: paddle