code: def __init__(
      self,
      input_num_filters: int,
      increase_dim: bool = False,
      projection: bool = False,
      last: bool = False,
  ):
      super().__init__()
      self.last: bool = last
  
      if increase_dim:
          first_stride = (2, 2)
          out_num_filters = input_num_filters * 2
      else:
          first_stride = (1, 1)
          out_num_filters = input_num_filters
  
      self.direct = Sequential(
          conv3x3(
              input_num_filters, out_num_filters, stride=first_stride
          ),
          batch_norm(out_num_filters),
          ReLU(True),
          conv3x3(out_num_filters, out_num_filters, stride=(1, 1)),
          batch_norm(out_num_filters),
      )
  
      self.shortcut: Module
  
      # add shortcut connections
      if increase_dim:
          if projection:
              # projection shortcut, as option B in paper
              self.shortcut = Sequential(
                  Conv2d(
                      input_num_filters,
                      out_num_filters,
                      kernel_size=(1, 1),
                      stride=(2, 2),
                      bias=False,
                  ),
                  batch_norm(out_num_filters),
              )
          else:
              # identity shortcut, as option A in paper
              self.shortcut = Sequential(
                  IdentityShortcut(lambda x: x[:, :, ::2, ::2]),
                  ConstantPad3d(
                      (
                          0,
                          0,
                          0,
                          0,
                          out_num_filters // 4,
                          out_num_filters // 4,
                      ),
                      0.0,
                  ),
              )
      else:
          self.shortcut = Identity()
  
imports: from typing import Union, Sequence, Callable
  import torch
  from torch.nn import Module, Sequential, BatchNorm2d, Conv2d, ReLU, ConstantPad3d, Identity, AdaptiveAvgPool2d, Linear
  from torch import Tensor
  from torch.nn.init import zeros_, kaiming_normal_
  from torch.nn.modules.flatten import Flatten
  import torch.nn.functional
label_desc: Use image node_id 1 to create a new ResidualBlock object from inherited base classes: Module with example: obj = ResidualBlock(input_num_filters, increase_dim, projection, last)