code: def create_x3d_bottleneck_block(
      *,
      # Convolution configs.
      dim_in: int,
      dim_inner: int,
      dim_out: int,
      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:
      """
      Bottleneck block for X3D: a sequence of Conv, Normalization with optional SE block,
      and Activations repeated in the following order:
  
      ::
  
                                      Conv3d (conv_a)
                                             ↓
                                   Normalization (norm_a)
                                             ↓
                                     Activation (act_a)
                                             ↓
                                      Conv3d (conv_b)
                                             ↓
                                   Normalization (norm_b)
                                             ↓
                                   Squeeze-and-Excitation
                                             ↓
                                     Activation (act_b)
                                             ↓
                                      Conv3d (conv_c)
                                             ↓
                                   Normalization (norm_c)
  
      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.
          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 bottleneck block.
      """
      # 1x1x1 Conv
      conv_a = nn.Conv3d(
          in_channels=dim_in,
          out_channels=dim_inner,
          kernel_size=(1, 1, 1),
          bias=False,
      )
      norm_a = (
          None
          if norm is None
          else norm(
              num_features=dim_inner,
              eps=norm_eps,
              momentum=norm_momentum,
          )
      )
      act_a = None if activation is None else activation()
  
      # 3x3x3 Conv
      conv_b = nn.Conv3d(
          in_channels=dim_inner,
          out_channels=dim_inner,
          kernel_size=conv_kernel_size,
          stride=conv_stride,
          padding=[size // 2 for size in conv_kernel_size],
          bias=False,
          groups=dim_inner,
          dilation=(1, 1, 1),
      )
      se = (
          SqueezeExcitation(
              num_channels=dim_inner,
              num_channels_reduced=round_width(dim_inner, se_ratio),
              is_3d=True,
          )
          if se_ratio > 0.0
          else nn.Identity()
      )
      norm_b = nn.Sequential(
          (
              nn.Identity()
              if norm is None
              else norm(
                  num_features=dim_inner,
                  eps=norm_eps,
                  momentum=norm_momentum,
              )
          ),
          se,
      )
      act_b = None if inner_act is None else inner_act()
  
      # 1x1x1 Conv
      conv_c = nn.Conv3d(
          in_channels=dim_inner,
          out_channels=dim_out,
          kernel_size=(1, 1, 1),
          bias=False,
      )
      norm_c = (
          None
          if norm is None
          else norm(
              num_features=dim_out, eps=norm_eps, momentum=norm_momentum
          )
      )
  
      return BottleneckBlock(
          conv_a=conv_a,
          norm_a=norm_a,
          act_a=act_a,
          conv_b=conv_b,
          norm_b=norm_b,
          act_b=act_b,
          conv_c=conv_c,
          norm_c=norm_c,
      )
  
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 2 for calling a global function with example usage: create_x3d_bottleneck_block() and returns: BottleneckBlock