code: def __init__(self, config: VitDetConfig) -> None:
      super().__init__()
      self.config = config
      depth = config.num_hidden_layers
  
      # stochastic depth decay rule
      drop_path_rate = [
          x.item()
          for x in torch.linspace(0, config.drop_path_rate, depth)
      ]
  
      layers = []
      for i in range(depth):
          layers.append(
              VitDetLayer(
                  config,
                  drop_path_rate=drop_path_rate[i],
                  window_size=config.window_size
                  if i in config.window_block_indices
                  else 0,
                  use_residual_block=i in config.residual_block_indices,
              )
          )
  
      self.layer = nn.ModuleList(layers)
      self.gradient_checkpointing = False
  
imports: import collections.abc
  import math
  from typing import Dict, List, Optional, Tuple, Union
  import torch
  import torch.utils.checkpoint
  from torch import nn
  from ...activations import ACT2FN
  from ...modeling_outputs import BackboneOutput, BaseModelOutput
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from ...utils.backbone_utils import BackboneMixin
  from .configuration_vitdet import VitDetConfig
label_desc: Use image node_id 1 to create a new VitDetEncoder object from inherited base classes: nn with example: obj = VitDetEncoder(config)