code: def __init__(
      self,
      in_channels,
      conv_dim: int,
      mask_dim: int,
      mask_on: bool,
      norm: Optional[Union[str, Callable]] = None,
  ):
      super().__init__()
  
      lateral_convs = []
      output_convs = []
  
      use_bias = norm == ""
      for idx, in_channel in enumerate(in_channels):
          if idx == len(in_channels) - 1:
              output_norm = get_norm(norm, conv_dim)
              output_conv = Conv2d(
                  in_channel,
                  conv_dim,
                  kernel_size=3,
                  stride=1,
                  padding=1,
                  bias=use_bias,
                  norm=output_norm,
                  activation=F.relu,
              )
              self.add_module("layer_{}".format(idx + 1), output_conv)
  
              lateral_convs.append(None)
              output_convs.append(output_conv)
          else:
              lateral_norm = get_norm(norm, conv_dim)
              output_norm = get_norm(norm, conv_dim)
  
              lateral_conv = Conv2d(
                  in_channel,
                  conv_dim,
                  kernel_size=1,
                  bias=use_bias,
                  norm=lateral_norm,
              )
              output_conv = Conv2d(
                  conv_dim,
                  conv_dim,
                  kernel_size=3,
                  stride=1,
                  padding=1,
                  bias=use_bias,
                  norm=output_norm,
                  activation=F.relu,
              )
              self.add_module(
                  "adapter_{}".format(idx + 1), lateral_conv
              )
              self.add_module("layer_{}".format(idx + 1), output_conv)
  
              lateral_convs.append(lateral_conv)
              output_convs.append(output_conv)
      # Place convs into top-down order (from low to high resolution)
      # to make the top-down computation in forward clearer.
      self.lateral_convs = lateral_convs[::-1]
      self.output_convs = output_convs[::-1]
  
      self.mask_on = mask_on
      if self.mask_on:
          self.mask_dim = mask_dim
          self.mask_features = Conv2d(
              conv_dim,
              mask_dim,
              kernel_size=3,
              stride=1,
              padding=1,
          )
      self.maskformer_num_feature_levels = 3
  
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 BasePixelDecoder object from inherited base classes: nn with example: obj = BasePixelDecoder(in_channels, conv_dim, mask_dim, mask_on, norm)