class_docstr: A RegNet stage composed by stacked layers.
class_docstr_tok: ["A","RegNet","stage","composed","by","stacked","layers","."]
code: def __init__(
      self,
      config: RegNetConfig,
      in_channels: int,
      out_channels: int,
      stride: int = 2,
      depth: int = 2,
  ):
      super().__init__()
  
      layer = RegNetXLayer if config.layer_type == "x" else RegNetYLayer
  
      self.layers = nn.Sequential(
          # downsampling is done in the first layer with stride of 2
          layer(
              config,
              in_channels,
              out_channels,
              stride=stride,
          ),
          *[
              layer(config, out_channels, out_channels)
              for _ in range(depth - 1)
          ],
      )
  
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 ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward
  from ...modeling_outputs import BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
  from ...modeling_utils import PreTrainedModel
  from ...utils import logging
  from .configuration_regnet import RegNetConfig
label_desc: Use image node_id 1 to create a new RegNetStage object from inherited base classes: nn with example: obj = RegNetStage(config, in_channels, out_channels, stride, depth)