class_docstr: A ResNet stage composed of stacked layers.
class_docstr_tok: ["A","ResNet","stage","composed","of","stacked","layers","."]
code: def __init__(
      self,
      config: ResNetConfig,
      in_channels: int,
      out_channels: int,
      stride: int = 2,
      depth: int = 2,
      **kwargs,
  ) -> None:
      super().__init__(**kwargs)
  
      layer = (
          TFResNetBottleNeckLayer
          if config.layer_type == "bottleneck"
          else TFResNetBasicLayer
      )
  
      layers = [
          layer(
              in_channels,
              out_channels,
              stride=stride,
              activation=config.hidden_act,
              name="layers.0",
          )
      ]
      layers += [
          layer(
              out_channels,
              out_channels,
              activation=config.hidden_act,
              name=f"layers.{i + 1}",
          )
          for i in range(depth - 1)
      ]
      self.stage_layers = layers
  
imports: from typing import Optional, Tuple, Union
  import tensorflow
  from ...activations_tf import ACT2FN
  from ...modeling_tf_outputs import TFBaseModelOutputWithNoAttention, TFBaseModelOutputWithPoolingAndNoAttention, TFImageClassifierOutputWithNoAttention
  from ...modeling_tf_utils import TFPreTrainedModel, TFSequenceClassificationLoss, keras_serializable, unpack_inputs
  from ...tf_utils import shape_list
  from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging
  from .configuration_resnet import ResNetConfig
label_desc: Use image node_id 1 to create a new TFResNetStage object from inherited base classes: tf.keras.layers with example: obj = TFResNetStage(config, in_channels, out_channels, stride, depth)