code: def __init__(self, config: ResNetConfig):
      super().__init__()
      self.stages = nn.ModuleList([])
      # based on `downsample_in_first_stage` the first layer of the first stage may or may not downsample the input
      self.stages.append(
          ResNetStage(
              config,
              config.embedding_size,
              config.hidden_sizes[0],
              stride=2 if config.downsample_in_first_stage else 1,
              depth=config.depths[0],
          )
      )
      in_out_channels = zip(
          config.hidden_sizes, config.hidden_sizes[1:]
      )
      for (in_channels, out_channels), depth in zip(
          in_out_channels, config.depths[1:]
      ):
          self.stages.append(
              ResNetStage(
                  config, in_channels, out_channels, depth=depth
              )
          )
  
imports: from typing import Optional
  import torch
  import torch.utils.checkpoint
  from torch import Tensor, 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_resnet import ResNetConfig
label_desc: Use image node_id 1 to create a new ResNetEncoder object from inherited base classes: nn with example: obj = ResNetEncoder(config)