code: def __init__(
      self,
      in_channels=[512, 1024, 2048],
      feat_strides=[8, 16, 32],
      hidden_dim=256,
      use_encoder_idx=[2],
      num_encoder_layers=1,
      encoder_layer="TransformerLayer",
      pe_temperature=10000,
      expansion=1.0,
      depth_mult=1.0,
      act="silu",
      trt=False,
      eval_size=None,
  ):
      super(HybridEncoder, self).__init__()
      self.in_channels = in_channels
      self.feat_strides = feat_strides
      self.hidden_dim = hidden_dim
      self.use_encoder_idx = use_encoder_idx
      self.num_encoder_layers = num_encoder_layers
      self.pe_temperature = pe_temperature
      self.eval_size = eval_size
  
      # channel projection
      self.input_proj = nn.LayerList()
      for in_channel in in_channels:
          self.input_proj.append(
              nn.Sequential(
                  nn.Conv2D(
                      in_channel,
                      hidden_dim,
                      kernel_size=1,
                      bias_attr=False,
                  ),
                  nn.BatchNorm2D(
                      hidden_dim,
                      weight_attr=ParamAttr(regularizer=L2Decay(0.0)),
                      bias_attr=ParamAttr(regularizer=L2Decay(0.0)),
                  ),
              )
          )
      # encoder transformer
      self.encoder = nn.LayerList(
          [
              TransformerEncoder(encoder_layer, num_encoder_layers)
              for _ in range(len(use_encoder_idx))
          ]
      )
  
      act = (
          get_act_fn(act, trt=trt)
          if act is None or isinstance(act, (str, dict))
          else act
      )
      # top-down fpn
      self.lateral_convs = nn.LayerList()
      self.fpn_blocks = nn.LayerList()
      for idx in range(len(in_channels) - 1, 0, -1):
          self.lateral_convs.append(
              BaseConv(hidden_dim, hidden_dim, 1, 1, act=act)
          )
          self.fpn_blocks.append(
              CSPRepLayer(
                  hidden_dim * 2,
                  hidden_dim,
                  round(3 * depth_mult),
                  act=act,
                  expansion=expansion,
              )
          )
  
      # bottom-up pan
      self.downsample_convs = nn.LayerList()
      self.pan_blocks = nn.LayerList()
      for idx in range(len(in_channels) - 1):
          self.downsample_convs.append(
              BaseConv(hidden_dim, hidden_dim, 3, stride=2, act=act)
          )
          self.pan_blocks.append(
              CSPRepLayer(
                  hidden_dim * 2,
                  hidden_dim,
                  round(3 * depth_mult),
                  act=act,
                  expansion=expansion,
              )
          )
  
      self._reset_parameters()
  
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 1 to create a new HybridEncoder object from inherited base classes: nn with example: obj = HybridEncoder(in_channels, feat_strides, hidden_dim, use_encoder_idx, num_encoder_layers, encoder_layer, pe_temperature, expansion, depth_mult, act, trt, eval_size)