code: def __init__(self, config: ResNetConfig, **kwargs) -> None:
      super().__init__(**kwargs)
      # based on `downsample_in_first_stage` the first layer of the first stage may or may not downsample the input
      self.stages = [
          TFResNetStage(
              config,
              config.embedding_size,
              config.hidden_sizes[0],
              stride=2 if config.downsample_in_first_stage else 1,
              depth=config.depths[0],
              name="stages.0",
          )
      ]
      for i, (in_channels, out_channels, depth) in enumerate(
          zip(
              config.hidden_sizes,
              config.hidden_sizes[1:],
              config.depths[1:],
          )
      ):
          self.stages.append(
              TFResNetStage(
                  config,
                  in_channels,
                  out_channels,
                  depth=depth,
                  name=f"stages.{i + 1}",
              )
          )
  
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 TFResNetEncoder object from inherited base classes: tf.keras.layers with example: obj = TFResNetEncoder(config)