code: def __init__(
      self,
      in_channels,
      transformer_dropout: float = 0.0,
      transformer_nheads: int = 8,
      transformer_dim_feedforward: int = 2048,
      transformer_enc_layers: int = 6,
      transformer_pre_norm: bool = False,
      conv_dim: int = 512,
      mask_dim: int = 512,
      norm: Optional[Union[str, Callable]] = "GN",
  ):
      super().__init__(
          in_channels,
          conv_dim=conv_dim,
          mask_dim=mask_dim,
          norm=norm,
          mask_on=True,
      )
  
      self.in_features = ["res2", "res3", "res4", "res5"]
      feature_channels = in_channels
  
      in_channels = feature_channels[len(in_channels) - 1]
      self.input_proj = Conv2d(in_channels, conv_dim, kernel_size=1)
      self.transformer = TransformerEncoderOnly(
          d_model=conv_dim,
          dropout=transformer_dropout,
          nhead=transformer_nheads,
          dim_feedforward=transformer_dim_feedforward,
          num_encoder_layers=transformer_enc_layers,
          normalize_before=transformer_pre_norm,
      )
      self.pe_layer = PositionEmbeddingSine(
          conv_dim // 2, normalize=True
      )
  
      # update layer
      use_bias = norm == ""
      output_norm = get_norm(norm, conv_dim)
      output_conv = Conv2d(
          conv_dim,
          conv_dim,
          kernel_size=3,
          stride=1,
          padding=1,
          bias=use_bias,
          norm=output_norm,
          activation=F.relu,
      )
      delattr(self, "layer_{}".format(len(self.in_features)))
      self.add_module(
          "layer_{}".format(len(self.in_features)), output_conv
      )
      self.output_convs[0] = output_conv
  
file_path: mmdetection/projects/XDecoder/xdecoder/pixel_decoder.py
imports: from typing import Callable, Optional, Union
  from torch import nn
  from torch.nn import functional
  from mmdet.registry import MODELS
  from .transformer_blocks import Conv2d, PositionEmbeddingSine, TransformerEncoder, TransformerEncoderLayer, get_norm
label_desc: Use image node_id 1 to create a new XTransformerEncoderPixelDecoder object from inherited base classes: BasePixelDecoder with example: obj = XTransformerEncoderPixelDecoder(in_channels, transformer_dropout, transformer_nheads, transformer_dim_feedforward, transformer_enc_layers, transformer_pre_norm, conv_dim, mask_dim, norm)