code: def create_x3d_res_stage(
      *,
      # Stage configs.
      depth: int,
      # Bottleneck Block configs.
      dim_in: int,
      dim_inner: int,
      dim_out: int,
      bottleneck: Callable = create_x3d_bottleneck_block,
      # 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:
      """
      Create Residual Stage, which composes sequential blocks that make up X3D.
  
      ::
  
                                          Input
                                             ↓
                                         ResBlock
                                             ↓
                                             .
                                             .
                                             .
                                             ↓
                                         ResBlock
  
      Args:
  
          depth (init): number of blocks to create.
  
          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 stage layer.
      """
      res_blocks = []
      for idx in range(depth):
          block = create_x3d_res_block(
              dim_in=dim_in if idx == 0 else dim_out,
              dim_inner=dim_inner,
              dim_out=dim_out,
              bottleneck=bottleneck,
              conv_kernel_size=conv_kernel_size,
              conv_stride=conv_stride if idx == 0 else (1, 1, 1),
              norm=norm,
              norm_eps=norm_eps,
              norm_momentum=norm_momentum,
              se_ratio=(se_ratio if (idx + 1) % 2 else 0.0),
              activation=activation,
              inner_act=inner_act,
          )
          res_blocks.append(block)
  
      return ResStage(res_blocks=nn.ModuleList(res_blocks))
  
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 4 for calling a global function with example usage: create_x3d_res_stage() and returns: ResStage