code: def __init__(
      self,
      d_model=512,
      nhead=8,
      num_encoder_layers=6,
      dim_feedforward=2048,
      dropout=0.1,
      activation="relu",
      normalize_before=False,
  ):
      super().__init__()
  
      encoder_layer = TransformerEncoderLayer(
          d_model,
          nhead,
          dim_feedforward,
          dropout,
          activation,
          normalize_before,
      )
      encoder_norm = nn.LayerNorm(d_model) if normalize_before else None
      self.encoder = TransformerEncoder(
          encoder_layer, num_encoder_layers, encoder_norm
      )
  
      self._reset_parameters()
  
      self.d_model = d_model
      self.nhead = nhead
  
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 TransformerEncoderOnly object from inherited base classes: nn with example: obj = TransformerEncoderOnly(d_model, nhead, num_encoder_layers, dim_feedforward, dropout, activation, normalize_before)