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",
  ):
      super().__init__()
      should_apply_shortcut = in_channels != out_channels or stride != 1
      self.shortcut = (
          ResNetShortCut(in_channels, out_channels, stride=stride)
          if should_apply_shortcut
          else nn.Identity()
      )
      self.layer = nn.Sequential(
          ResNetConvLayer(in_channels, out_channels, stride=stride),
          ResNetConvLayer(out_channels, out_channels, activation=None),
      )
      self.activation = ACT2FN[activation]
  
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 ResNetBasicLayer object from inherited base classes: nn with example: obj = ResNetBasicLayer(in_channels, out_channels, stride, activation)