code: def __init__(self, config):
      super().__init__()
      self.stages = nn.ModuleList()
      drop_path_rates = [
          x.tolist()
          for x in torch.linspace(
              0, config.drop_path_rate, sum(config.depths)
          ).split(config.depths)
      ]
      prev_chs = config.hidden_sizes[0]
      for i in range(config.num_stages):
          out_chs = config.hidden_sizes[i]
          stage = ConvNextV2Stage(
              config,
              in_channels=prev_chs,
              out_channels=out_chs,
              stride=2 if i > 0 else 1,
              depth=config.depths[i],
              drop_path_rates=drop_path_rates[i],
          )
          self.stages.append(stage)
          prev_chs = out_chs
  
imports: from typing import Optional, Tuple, Union
  import torch
  import torch.utils.checkpoint
  from torch import nn
  from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
  from ...activations import ACT2FN
  from ...modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from ...utils.backbone_utils import BackboneMixin
  from .configuration_convnextv2 import ConvNextV2Config
label_desc: Use image node_id 1 to create a new ConvNextV2Encoder object from inherited base classes: nn with example: obj = ConvNextV2Encoder(config)