class_docstr: SlowFast networks (SlowFast) from
  `"SlowFast Networks for Video Recognition"
  <https://arxiv.org/abs/1812.03982>`_ paper.
  
  Parameters
  ----------
  nclass : int.
      Number of categories in the dataset.
  block : a HybridBlock.
      Building block of a ResNet, could be Basic or Bottleneck.
  layers : a list or tuple, default is None.
      Number of stages in a ResNet, e.g., [3, 4, 6, 3] in ResNet50.
  num_block_temp_kernel_fast : int, default is None.
      If the current block has more than NUM_BLOCK_TEMP_KERNEL blocks,
      use temporal kernel of 1 for the rest of the blocks.
  num_block_temp_kernel_slow : int, default is None.
      If the current block has more than NUM_BLOCK_TEMP_KERNEL blocks,
      use temporal kernel of 1 for the rest of the blocks.
  pretrained : bool or str.
      Boolean value controls whether to load the default pretrained weights for model.
      String value represents the hashtag for a certain version of pretrained weights.
  pretrained_base : bool or str, optional, default is True.
      Load pretrained base network, the extra layers are randomized. Note that
      if pretrained is `True`, this has no effect.
  feat_ext : bool.
      Whether to extract features before dense classification layer or
      do a complete forward pass.
  num_segments : int, default is 1.
      Number of segments used to evenly divide a video.
  num_crop : int, default is 1.
      Number of crops used during evaluation, choices are 1, 3 or 10.
  bn_eval : bool.
      Whether to set BN layers to eval mode, namely, freeze
      running stats (mean and var).
  bn_frozen : bool.
      Whether to freeze weight and bias of BN layers.
  partial_bn : bool, default False.
      Freeze all batch normalization layers during training except the first layer.
  frozen_stages : int.
      Stages to be frozen (all param fixed). -1 means not freezing any parameters.
  dropout_ratio : float, default is 0.5.
      The dropout rate of a dropout layer.
      The larger the value, the more strength to prevent overfitting.
  init_std : float, default is 0.001.
      Standard deviation value when initialize the dense layers.
  alpha : int, default is 8.
      Corresponds to the frame rate reduction ratio between the Slow and Fast pathways.
  beta_inv : int, default is 8.
      Corresponds to the inverse of the channel reduction ratio between the Slow and Fast pathways.
  fusion_conv_channel_ratio : int, default is 2.
      Ratio of channel dimensions between the Slow and Fast pathways.
  fusion_kernel_size : int, default is 5.
      Kernel dimension used for fusing information from Fast pathway to Slow pathway.
  width_per_group : int, default is 64.
      Width of each group (64 -> ResNet; 4 -> ResNeXt).
  num_groups : int, default is 1.
      Number of groups for the convolution.
      Num_groups=1 is for standard ResNet like networks,
      and num_groups>1 is for ResNeXt like networks.
  slow_temporal_stride : int, default 16.
      The temporal stride for sparse sampling of video frames in slow branch of a SlowFast network.
  fast_temporal_stride : int, default 2.
      The temporal stride for sparse sampling of video frames in fast branch of a SlowFast network.
  slow_frames : int, default 4.
      The number of frames used as input to a slow branch.
  fast_frames : int, default 32.
      The number of frames used as input to a fast branch.
  norm_layer : object
      Normalization layer used (default: :class:`mxnet.gluon.nn.BatchNorm`)
      Can be :class:`mxnet.gluon.nn.BatchNorm` or :class:`mxnet.gluon.contrib.nn.SyncBatchNorm`.
  norm_kwargs : dict
      Additional `norm_layer` arguments, for example `num_devices=4`
      for :class:`mxnet.gluon.contrib.nn.SyncBatchNorm`.
  ctx : Context, default CPU.
      The context in which to load the pretrained weights.
class_docstr_tok: ["SlowFast","networks","(","SlowFast",")","from","`","``","SlowFast","Networks","for","Video","Recognition","''","<","https",":","\/\/arxiv.org\/abs\/1812.03982",">","`","_","paper",".","Parameters","--","--","--","--","--","nclass",":","int",".","Number","of","categories","in","the","dataset",".","block",":","a","HybridBlock",".","Building","block","of","a","ResNet",",","could","be","Basic","or","Bottleneck",".","layers",":","a","list","or","tuple",",","default","is","None",".","Number","of","stages","in","a","ResNet",",","e.g.",",","[","3",",","4",",","6",",","3","]","in","ResNet50",".","num_block_temp_kernel_fast",":","int",",","default","is","None",".","If","the","current","block","has","more","than","NUM_BLOCK_TEMP_KERNEL","blocks",",","use","temporal","kernel","of","1","for","the","rest","of","the","blocks",".","num_block_temp_kernel_slow",":","int",",","default","is","None",".","If","the","current","block","has","more","than","NUM_BLOCK_TEMP_KERNEL","blocks",",","use","temporal","kernel","of","1","for","the","rest","of","the","blocks",".","pretrained",":","bool","or","str",".","Boolean","value","controls","whether","to","load","the","default","pretrained","weights","for","model",".","String","value","represents","the","hashtag","for","a","certain","version","of","pretrained","weights",".","pretrained_base",":","bool","or","str",",","optional",",","default","is","True",".","Load","pretrained","base","network",",","the","extra","layers","are","randomized",".","Note","that","if","pretrained","is","`","True","`",",","this","has","no","effect",".","feat_ext",":","bool",".","Whether","to","extract","features","before","dense","classification","layer","or","do","a","complete","forward","pass",".","num_segments",":","int",",","default","is","1",".","Number","of","segments","used","to","evenly","divide","a","video",".","num_crop",":","int",",","default","is","1",".","Number","of","crops","used","during","evaluation",",","choices","are","1",",","3","or","10.","bn_eval",":","bool",".","Whether","to","set","BN","layers","to","eval","mode",",","namely",",","freeze","running","stats","(","mean","and","var",")",".","bn_frozen",":","bool",".","Whether","to","freeze","weight","and","bias","of","BN","layers",".","partial_bn",":","bool",",","default","False",".","Freeze","all","batch","normalization","layers","during","training","except","the","first","layer",".","frozen_stages",":","int",".","Stages","to","be","frozen","(","all","param","fixed",")",".","-1","means","not","freezing","any","parameters",".","dropout_ratio",":","float",",","default","is","0.5",".","The","dropout","rate","of","a","dropout","layer",".","The","larger","the","value",",","the","more","strength","to","prevent","overfitting",".","init_std",":","float",",","default","is","0.001",".","Standard","deviation","value","when","initialize","the","dense","layers",".","alpha",":","int",",","default","is","8",".","Corresponds","to","the","frame","rate","reduction","ratio","between","the","Slow","and","Fast","pathways",".","beta_inv",":","int",",","default","is","8",".","Corresponds","to","the","inverse","of","the","channel","reduction","ratio","between","the","Slow","and","Fast","pathways",".","fusion_conv_channel_ratio",":","int",",","default","is","2",".","Ratio","of","channel","dimensions","between","the","Slow","and","Fast","pathways",".","fusion_kernel_size",":","int",",","default","is","5",".","Kernel","dimension","used","for","fusing","information","from","Fast","pathway","to","Slow","pathway",".","width_per_group",":","int",",","default","is","64",".","Width","of","each","group","(","64","-",">","ResNet",";","4","-",">","ResNeXt",")",".","num_groups",":","int",",","default","is","1",".","Number","of","groups","for","the","convolution",".","Num_groups=1","is","for","standard","ResNet","like","networks",",","and","num_groups",">","1","is","for","ResNeXt","like","networks",".","slow_temporal_stride",":","int",",","default","16",".","The","temporal","stride","for","sparse","sampling","of","video","frames","in","slow","branch","of","a","SlowFast","network",".","fast_temporal_stride",":","int",",","default","2",".","The","temporal","stride","for","sparse","sampling","of","video","frames","in","fast","branch","of","a","SlowFast","network",".","slow_frames",":","int",",","default","4",".","The","number","of","frames","used","as","input","to","a","slow","branch",".","fast_frames",":","int",",","default","32",".","The","number","of","frames","used","as","input","to","a","fast","branch",".","norm_layer",":","object","Normalization","layer","used","(","default",":",":","class",":","`","mxnet.gluon.nn.BatchNorm","`",")","Can","be",":","class",":","`","mxnet.gluon.nn.BatchNorm","`","or",":","class",":","`","mxnet.gluon.contrib.nn.SyncBatchNorm","`",".","norm_kwargs",":","dict","Additional","`","norm_layer","`","arguments",",","for","example","`","num_devices=4","`","for",":","class",":","`","mxnet.gluon.contrib.nn.SyncBatchNorm","`",".","ctx",":","Context",",","default","CPU",".","The","context","in","which","to","load","the","pretrained","weights","."]
code: def __init__(
      self,
      nclass,
      block=Bottleneck,
      layers=None,
      num_block_temp_kernel_fast=None,
      num_block_temp_kernel_slow=None,
      pretrained=False,
      pretrained_base=False,
      feat_ext=False,
      num_segments=1,
      num_crop=1,
      bn_eval=True,
      bn_frozen=False,
      partial_bn=False,
      frozen_stages=-1,
      dropout_ratio=0.5,
      init_std=0.01,
      alpha=8,
      beta_inv=8,
      fusion_conv_channel_ratio=2,
      fusion_kernel_size=5,
      width_per_group=64,
      num_groups=1,
      slow_temporal_stride=16,
      fast_temporal_stride=2,
      slow_frames=4,
      fast_frames=32,
      norm_layer=BatchNorm,
      norm_kwargs=None,
      ctx=None,
      **kwargs,
  ):
      super(SlowFast, self).__init__()
      self.num_segments = num_segments
      self.num_crop = num_crop
      self.dropout_ratio = dropout_ratio
      self.init_std = init_std
      self.alpha = alpha
      self.beta_inv = beta_inv
      self.fusion_conv_channel_ratio = fusion_conv_channel_ratio
      self.fusion_kernel_size = fusion_kernel_size
      self.width_per_group = width_per_group
      self.num_groups = num_groups
      self.dim_inner = self.num_groups * self.width_per_group
      self.out_dim_ratio = (
          self.beta_inv // self.fusion_conv_channel_ratio
      )
      self.slow_temporal_stride = slow_temporal_stride
      self.fast_temporal_stride = fast_temporal_stride
      self.slow_frames = slow_frames
      self.fast_frames = fast_frames
      self.feat_ext = feat_ext
  
      with self.name_scope():
          # build fast pathway
          fast = nn.HybridSequential(prefix="fast_")
          with fast.name_scope():
              self.fast_conv1 = nn.Conv3D(
                  in_channels=3,
                  channels=self.width_per_group // self.beta_inv,
                  kernel_size=(5, 7, 7),
                  strides=(1, 2, 2),
                  padding=(2, 3, 3),
                  use_bias=False,
              )
              self.fast_bn1 = norm_layer(
                  in_channels=self.width_per_group // self.beta_inv,
                  **({} if norm_kwargs is None else norm_kwargs),
              )
              self.fast_relu = nn.Activation("relu")
              self.fast_maxpool = nn.MaxPool3D(
                  pool_size=(1, 3, 3),
                  strides=(1, 2, 2),
                  padding=(0, 1, 1),
              )
          self.fast_res2 = self._make_layer_fast(
              inplanes=self.width_per_group // self.beta_inv,
              planes=self.dim_inner // self.beta_inv,
              num_blocks=layers[0],
              head_conv=3,
              norm_layer=norm_layer,
              norm_kwargs=norm_kwargs,
              layer_name="fast_res2_",
          )
          self.fast_res3 = self._make_layer_fast(
              inplanes=self.width_per_group * 4 // self.beta_inv,
              planes=self.dim_inner * 2 // self.beta_inv,
              num_blocks=layers[1],
              strides=2,
              head_conv=3,
              norm_layer=norm_layer,
              norm_kwargs=norm_kwargs,
              layer_name="fast_res3_",
          )
          self.fast_res4 = self._make_layer_fast(
              inplanes=self.width_per_group * 8 // self.beta_inv,
              planes=self.dim_inner * 4 // self.beta_inv,
              num_blocks=layers[2],
              num_block_temp_kernel_fast=num_block_temp_kernel_fast,
              strides=2,
              head_conv=3,
              norm_layer=norm_layer,
              norm_kwargs=norm_kwargs,
              layer_name="fast_res4_",
          )
          self.fast_res5 = self._make_layer_fast(
              inplanes=self.width_per_group * 16 // self.beta_inv,
              planes=self.dim_inner * 8 // self.beta_inv,
              num_blocks=layers[3],
              strides=2,
              head_conv=3,
              norm_layer=norm_layer,
              norm_kwargs=norm_kwargs,
              layer_name="fast_res5_",
          )
  
          # build lateral connections
          self.lateral_p1 = nn.HybridSequential(prefix="lateral_p1_")
          with self.lateral_p1.name_scope():
              self.lateral_p1.add(
                  nn.Conv3D(
                      in_channels=self.width_per_group // self.beta_inv,
                      channels=self.width_per_group
                      // self.beta_inv
                      * self.fusion_conv_channel_ratio,
                      kernel_size=(self.fusion_kernel_size, 1, 1),
                      strides=(self.alpha, 1, 1),
                      padding=(self.fusion_kernel_size // 2, 0, 0),
                      use_bias=False,
                  )
              )
              self.lateral_p1.add(
                  norm_layer(
                      in_channels=self.width_per_group
                      // self.beta_inv
                      * self.fusion_conv_channel_ratio,
                      **({} if norm_kwargs is None else norm_kwargs),
                  )
              )
              self.lateral_p1.add(nn.Activation("relu"))
  
          self.lateral_res2 = nn.HybridSequential(
              prefix="lateral_res2_"
          )
          with self.lateral_res2.name_scope():
              self.lateral_res2.add(
                  nn.Conv3D(
                      in_channels=self.width_per_group
                      * 4
                      // self.beta_inv,
                      channels=self.width_per_group
                      * 4
                      // self.beta_inv
                      * self.fusion_conv_channel_ratio,
                      kernel_size=(self.fusion_kernel_size, 1, 1),
                      strides=(self.alpha, 1, 1),
                      padding=(self.fusion_kernel_size // 2, 0, 0),
                      use_bias=False,
                  )
              )
              self.lateral_res2.add(
                  norm_layer(
                      in_channels=self.width_per_group
                      * 4
                      // self.beta_inv
                      * self.fusion_conv_channel_ratio,
                      **({} if norm_kwargs is None else norm_kwargs),
                  )
              )
              self.lateral_res2.add(nn.Activation("relu"))
  
          self.lateral_res3 = nn.HybridSequential(
              prefix="lateral_res3_"
          )
          with self.lateral_res3.name_scope():
              self.lateral_res3.add(
                  nn.Conv3D(
                      in_channels=self.width_per_group
                      * 8
                      // self.beta_inv,
                      channels=self.width_per_group
                      * 8
                      // self.beta_inv
                      * self.fusion_conv_channel_ratio,
                      kernel_size=(self.fusion_kernel_size, 1, 1),
                      strides=(self.alpha, 1, 1),
                      padding=(self.fusion_kernel_size // 2, 0, 0),
                      use_bias=False,
                  )
              )
              self.lateral_res3.add(
                  norm_layer(
                      in_channels=self.width_per_group
                      * 8
                      // self.beta_inv
                      * self.fusion_conv_channel_ratio,
                      **({} if norm_kwargs is None else norm_kwargs),
                  )
              )
              self.lateral_res3.add(nn.Activation("relu"))
  
          self.lateral_res4 = nn.HybridSequential(
              prefix="lateral_res4_"
          )
          with self.lateral_res4.name_scope():
              self.lateral_res4.add(
                  nn.Conv3D(
                      in_channels=self.width_per_group
                      * 16
                      // self.beta_inv,
                      channels=self.width_per_group
                      * 16
                      // self.beta_inv
                      * self.fusion_conv_channel_ratio,
                      kernel_size=(self.fusion_kernel_size, 1, 1),
                      strides=(self.alpha, 1, 1),
                      padding=(self.fusion_kernel_size // 2, 0, 0),
                      use_bias=False,
                  )
              )
              self.lateral_res4.add(
                  norm_layer(
                      in_channels=self.width_per_group
                      * 16
                      // self.beta_inv
                      * self.fusion_conv_channel_ratio,
                      **({} if norm_kwargs is None else norm_kwargs),
                  )
              )
              self.lateral_res4.add(nn.Activation("relu"))
  
          # build slow pathway
          slow = nn.HybridSequential(prefix="slow_")
          with slow.name_scope():
              self.slow_conv1 = nn.Conv3D(
                  in_channels=3,
                  channels=self.width_per_group,
                  kernel_size=(1, 7, 7),
                  strides=(1, 2, 2),
                  padding=(0, 3, 3),
                  use_bias=False,
              )
              self.slow_bn1 = norm_layer(
                  in_channels=self.width_per_group,
                  **({} if norm_kwargs is None else norm_kwargs),
              )
              self.slow_relu = nn.Activation("relu")
              self.slow_maxpool = nn.MaxPool3D(
                  pool_size=(1, 3, 3),
                  strides=(1, 2, 2),
                  padding=(0, 1, 1),
              )
          self.slow_res2 = self._make_layer_slow(
              inplanes=self.width_per_group
              + self.width_per_group // self.out_dim_ratio,
              planes=self.dim_inner,
              num_blocks=layers[0],
              head_conv=1,
              norm_layer=norm_layer,
              norm_kwargs=norm_kwargs,
              layer_name="slow_res2_",
          )
          self.slow_res3 = self._make_layer_slow(
              inplanes=self.width_per_group * 4
              + self.width_per_group * 4 // self.out_dim_ratio,
              planes=self.dim_inner * 2,
              num_blocks=layers[1],
              strides=2,
              head_conv=1,
              norm_layer=norm_layer,
              norm_kwargs=norm_kwargs,
              layer_name="slow_res3_",
          )
          self.slow_res4 = self._make_layer_slow(
              inplanes=self.width_per_group * 8
              + self.width_per_group * 8 // self.out_dim_ratio,
              planes=self.dim_inner * 4,
              num_blocks=layers[2],
              num_block_temp_kernel_slow=num_block_temp_kernel_slow,
              strides=2,
              head_conv=3,
              norm_layer=norm_layer,
              norm_kwargs=norm_kwargs,
              layer_name="slow_res4_",
          )
          self.slow_res5 = self._make_layer_slow(
              inplanes=self.width_per_group * 16
              + self.width_per_group * 16 // self.out_dim_ratio,
              planes=self.dim_inner * 8,
              num_blocks=layers[3],
              strides=2,
              head_conv=3,
              norm_layer=norm_layer,
              norm_kwargs=norm_kwargs,
              layer_name="slow_res5_",
          )
  
          # build classifier
          self.avg = nn.GlobalAvgPool3D()
          self.dp = nn.Dropout(rate=self.dropout_ratio)
          self.feat_dim = (
              self.width_per_group * 32 // self.beta_inv
              + self.width_per_group * 32
          )
          self.fc = nn.Dense(
              in_units=self.feat_dim,
              units=nclass,
              weight_initializer=init.Normal(sigma=self.init_std),
              use_bias=True,
          )
  
          self.initialize(init.MSRAPrelu(), ctx=ctx)
  
imports: from mxnet import init
  from mxnet.context import cpu
  from mxnet.gluon.block import HybridBlock
  from mxnet.gluon import nn
  from mxnet.gluon.nn import BatchNorm
label_desc: Use image node_id 1 to create a new SlowFast object from inherited base classes: HybridBlock with example: obj = SlowFast(nclass, block, layers, num_block_temp_kernel_fast, num_block_temp_kernel_slow, pretrained, pretrained_base, feat_ext, num_segments, num_crop, bn_eval, bn_frozen, partial_bn, frozen_stages, dropout_ratio, init_std, alpha, beta_inv, fusion_conv_channel_ratio, fusion_kernel_size, width_per_group, num_groups, slow_temporal_stride, fast_temporal_stride, slow_frames, fast_frames, norm_layer, norm_kwargs, ctx)