class_docstr: A classic ResNet's residual layer composed by two `3x3` convolutions.
class_docstr_tok: ["A","classic","ResNet","'s","residual","layer","composed","by","two","`","3x3","`","convolutions","."]
code: def __init__(
      self,
      in_channels: int,
      out_channels: int,
      stride: int = 1,
      activation: str = "relu",
      **kwargs,
  ) -> None:
      super().__init__(**kwargs)
      should_apply_shortcut = in_channels != out_channels or stride != 1
      self.conv1 = TFResNetConvLayer(
          in_channels, out_channels, stride=stride, name="layer.0"
      )
      self.conv2 = TFResNetConvLayer(
          out_channels, out_channels, activation=None, name="layer.1"
      )
      self.shortcut = (
          TFResNetShortCut(
              in_channels, out_channels, stride=stride, name="shortcut"
          )
          if should_apply_shortcut
          else tf.keras.layers.Activation("linear", name="shortcut")
      )
      self.activation = ACT2FN[activation]
  
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 TFResNetBasicLayer object from inherited base classes: tf.keras.layers with example: obj = TFResNetBasicLayer(in_channels, out_channels, stride, activation)