code: def create_x3d_res_block(
      *,
      # Bottleneck Block configs.
      dim_in: int,
      dim_inner: int,
      dim_out: int,
      bottleneck: Callable = create_x3d_bottleneck_block,
      use_shortcut: bool = True,
      # Conv configs.
      conv_kernel_size: Tuple[int] = (3, 3, 3),
      conv_stride: Tuple[int] = (1, 2, 2),
      # Norm configs.
      norm: Callable = nn.BatchNorm3d,
      norm_eps: float = 1e-5,
      norm_momentum: float = 0.1,
      se_ratio: float = 0.0625,
      # Activation configs.
      activation: Callable = nn.ReLU,
      inner_act: Callable = Swish,
  ) -> nn.Module:
      """
      Residual block for X3D. Performs a summation between an identity shortcut in branch1 and a
      main block in branch2. When the input and output dimensions are different, a
      convolution followed by a normalization will be performed.
  
      ::
  
                                           Input
                                             |-------+
                                             ↓       |
                                           Block     |
                                             ↓       |
                                         Summation ←-+
                                             ↓
                                         Activation
  
      Args:
          dim_in (int): input channel size to the bottleneck block.
          dim_inner (int): intermediate channel size of the bottleneck.
          dim_out (int): output channel size of the bottleneck.
          bottleneck (callable): a callable for create_x3d_bottleneck_block.
  
          conv_kernel_size (tuple): convolutional kernel size(s) for conv_b.
          conv_stride (tuple): convolutional stride size(s) for conv_b.
  
          norm (callable): a callable that constructs normalization layer, examples
              include nn.BatchNorm3d, None (not performing normalization).
          norm_eps (float): normalization epsilon.
          norm_momentum (float): normalization momentum.
          se_ratio (float): if > 0, apply SE to the 3x3x3 conv, with the SE
              channel dimensionality being se_ratio times the 3x3x3 conv dim.
  
          activation (callable): a callable that constructs activation layer, examples
              include: nn.ReLU, nn.Softmax, nn.Sigmoid, and None (not performing
              activation).
          inner_act (callable): whether use Swish activation for act_b or not.
  
      Returns:
          (nn.Module): X3D block layer.
      """
  
      norm_model = None
      if norm is not None and dim_in != dim_out:
          norm_model = norm(num_features=dim_out)
  
      return ResBlock(
          branch1_conv=nn.Conv3d(
              dim_in,
              dim_out,
              kernel_size=(1, 1, 1),
              stride=conv_stride,
              bias=False,
          )
          if (dim_in != dim_out or np.prod(conv_stride) > 1)
          and use_shortcut
          else None,
          branch1_norm=norm_model
          if dim_in != dim_out and use_shortcut
          else None,
          branch2=bottleneck(
              dim_in=dim_in,
              dim_inner=dim_inner,
              dim_out=dim_out,
              conv_kernel_size=conv_kernel_size,
              conv_stride=conv_stride,
              norm=norm,
              norm_eps=norm_eps,
              norm_momentum=norm_momentum,
              se_ratio=se_ratio,
              activation=activation,
              inner_act=inner_act,
          ),
          activation=None if activation is None else activation(),
          branch_fusion=lambda x, y: x + y,
      )
  
imports: import math
  from typing import Callable, Tuple
  import numpy
  import torch
  import torch.nn
  from fvcore.nn.squeeze_excitation import SqueezeExcitation
  from pytorchvideo.layers.convolutions import Conv2plus1d
  from pytorchvideo.layers.swish import Swish
  from pytorchvideo.layers.utils import round_repeats, round_width, set_attributes
  from pytorchvideo.models.head import ResNetBasicHead
  from pytorchvideo.models.net import Net
  from pytorchvideo.models.resnet import BottleneckBlock, ResBlock, ResStage
  from pytorchvideo.models.stem import ResNetBasicStem
label_desc: Use image node_id 3 for calling a global function with example usage: create_x3d_res_block() and returns: ResBlock