class_docstr: ResNet_I3D backbone.
  Inflated 3D model (I3D) from
  `"Quo Vadis, Action Recognition? A New Model and the Kinetics Dataset"
  <https://arxiv.org/abs/1705.07750>`_ paper.
  
  Parameters
  ----------
  nclass : int.
      Number of categories in the dataset.
  depth : int, default is 50.
      Depth of ResNet, from {18, 34, 50, 101, 152}.
  num_stages : int, default is 4.
      Number of stages in a ResNet.
  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.
  spatial_strides : tuple of int.
      Strides in the spatial dimension of the first block of each stage.
  temporal_strides : tuple of int.
      Strides in the temporal dimension of the first block of each stage.
  dilations : tuple of int.
      Dilation ratio of each stage.
  out_indices : tuple of int.
      Collect features from the selected stages of ResNet,
      usually used for feature extraction or auxililary loss.
  conv1_kernel_t : int, default is 5.
      The kernel size of first convolutional layer in a ResNet.
  conv1_stride_t : int, default is 2.
      The stride of first convolutional layer in a ResNet.
  pool1_kernel_t : int, default is 1.
      The kernel size of first pooling layer in a ResNet.
  pool1_stride_t : int, default is 2.
      The stride of first pooling layer in a ResNet.
  inflate_freq : tuple of int.
      Select which 2D convolutional layers to be inflated to 3D convolutional layers in each stage.
  inflate_stride : tuple of int.
      The stride for inflated layers in each stage.
  inflate_style : str, default is '3x1x1'.
      How to inflate a 2D kernel, either '3x1x1' or '1x3x3'.
  nonlocal_stages : tuple of int.
      Select which stage we need non-local blocks.
  nonlocal_freq : tuple of int.
      Select where to insert non-local blocks in each stage.
  nonlocal_cfg : dict.
      Additional `non-local` arguments, for example `nonlocal_type='gaussian'`.
  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.
  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: ["ResNet_I3D","backbone",".","Inflated","3D","model","(","I3D",")","from","`","``","Quo","Vadis",",","Action","Recognition","?","A","New","Model","and","the","Kinetics","Dataset","''","<","https",":","\/\/arxiv.org\/abs\/1705.07750",">","`","_","paper",".","Parameters","--","--","--","--","--","nclass",":","int",".","Number","of","categories","in","the","dataset",".","depth",":","int",",","default","is","50",".","Depth","of","ResNet",",","from","{","18",",","34",",","50",",","101",",","152","}",".","num_stages",":","int",",","default","is","4",".","Number","of","stages","in","a","ResNet",".","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.","spatial_strides",":","tuple","of","int",".","Strides","in","the","spatial","dimension","of","the","first","block","of","each","stage",".","temporal_strides",":","tuple","of","int",".","Strides","in","the","temporal","dimension","of","the","first","block","of","each","stage",".","dilations",":","tuple","of","int",".","Dilation","ratio","of","each","stage",".","out_indices",":","tuple","of","int",".","Collect","features","from","the","selected","stages","of","ResNet",",","usually","used","for","feature","extraction","or","auxililary","loss",".","conv1_kernel_t",":","int",",","default","is","5",".","The","kernel","size","of","first","convolutional","layer","in","a","ResNet",".","conv1_stride_t",":","int",",","default","is","2",".","The","stride","of","first","convolutional","layer","in","a","ResNet",".","pool1_kernel_t",":","int",",","default","is","1",".","The","kernel","size","of","first","pooling","layer","in","a","ResNet",".","pool1_stride_t",":","int",",","default","is","2",".","The","stride","of","first","pooling","layer","in","a","ResNet",".","inflate_freq",":","tuple","of","int",".","Select","which","2D","convolutional","layers","to","be","inflated","to","3D","convolutional","layers","in","each","stage",".","inflate_stride",":","tuple","of","int",".","The","stride","for","inflated","layers","in","each","stage",".","inflate_style",":","str",",","default","is","'3x1x1","'",".","How","to","inflate","a","2D","kernel",",","either","'3x1x1","'","or","'1x3x3","'",".","nonlocal_stages",":","tuple","of","int",".","Select","which","stage","we","need","non-local","blocks",".","nonlocal_freq",":","tuple","of","int",".","Select","where","to","insert","non-local","blocks","in","each","stage",".","nonlocal_cfg",":","dict",".","Additional","`","non-local","`","arguments",",","for","example","`","nonlocal_type='gaussian","'","`",".","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",".","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","."]
docstr: Hybrid forward of I3D network
docstr_tok: ["Hybrid","forward","of","I3D","network"]
code: def hybrid_forward(self, F, x):
      """Hybrid forward of I3D network"""
      x = self.first_stage(x)
      outs = []
      for i, res_layer in enumerate(self.res_layers):
          x = res_layer(x)
          if i in self.out_indices:
              outs.append(x)
          if i == 0:
              x = self.pool2(x)
  
      feat = outs[0]
  
      # spatial temporal average
      pooled_feat = self.st_avg(feat)
      x = F.squeeze(pooled_feat, axis=(2, 3, 4))
  
      # segmental consensus
      x = F.reshape(
          x,
          shape=(-1, self.num_segments * self.num_crop, self.feat_dim),
      )
      x = F.mean(x, axis=1)
  
      if self.feat_ext:
          return x
  
      x = self.head(x)
      return x
  
imports: from mxnet import nd
  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
  from ..resnetv1b import resnet50_v1b, resnet101_v1b
  from .non_local import build_nonlocal_block
label_desc: Use image node_id 3 for calling the I3D_ResNetV1 obj's underlying member method code with example usage: obj.hybrid_forward(F, x) and returns: x, x