class_docstr: The R2+1D network.
  A Closer Look at Spatiotemporal Convolutions for Action Recognition.
  CVPR, 2018. https://arxiv.org/abs/1711.11248
  
  Parameters
  ----------
  nclass : int
      Number of classes in the training dataset.
  block : Block, default is `Bottleneck`.
      Class for the residual block.
  layers : list of int
      Numbers of layers in each block
  dropout_ratio : float, default is 0.5.
      The dropout rate of a dropout layer.
      The larger the value, the more strength to prevent overfitting.
  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.
  feat_ext : bool.
      Whether to extract features before dense classification layer or
      do a complete forward pass.
  init_std : float, default is 0.001.
      Standard deviation value when initialize the dense layers.
  ctx : Context, default CPU.
      The context in which to load the pretrained weights.
  partial_bn : bool, default False.
      Freeze all batch normalization layers during training except the first layer.
  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`.
class_docstr_tok: ["The","R2+1D","network",".","A","Closer","Look","at","Spatiotemporal","Convolutions","for","Action","Recognition",".","CVPR",",","2018.","https",":","\/\/arxiv.org\/abs\/1711.11248","Parameters","--","--","--","--","--","nclass",":","int","Number","of","classes","in","the","training","dataset",".","block",":","Block",",","default","is","`","Bottleneck","`",".","Class","for","the","residual","block",".","layers",":","list","of","int","Numbers","of","layers","in","each","block","dropout_ratio",":","float",",","default","is","0.5",".","The","dropout","rate","of","a","dropout","layer",".","The","larger","the","value",",","the","more","strength","to","prevent","overfitting",".","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.","feat_ext",":","bool",".","Whether","to","extract","features","before","dense","classification","layer","or","do","a","complete","forward","pass",".","init_std",":","float",",","default","is","0.001",".","Standard","deviation","value","when","initialize","the","dense","layers",".","ctx",":","Context",",","default","CPU",".","The","context","in","which","to","load","the","pretrained","weights",".","partial_bn",":","bool",",","default","False",".","Freeze","all","batch","normalization","layers","during","training","except","the","first","layer",".","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","`","."]
code: def __init__(
      self,
      nclass,
      block,
      layers,
      dropout_ratio=0.5,
      num_segments=1,
      num_crop=1,
      feat_ext=False,
      init_std=0.001,
      ctx=None,
      partial_bn=False,
      norm_layer=BatchNorm,
      norm_kwargs=None,
      **kwargs,
  ):
      super(R2Plus1D, self).__init__()
      self.partial_bn = partial_bn
      self.dropout_ratio = dropout_ratio
      self.init_std = init_std
      self.num_segments = num_segments
      self.num_crop = num_crop
      self.feat_ext = feat_ext
      self.inplanes = 64
      self.feat_dim = 512 * block.expansion
  
      with self.name_scope():
          self.conv1 = nn.Conv3D(
              in_channels=3,
              channels=45,
              kernel_size=(1, 7, 7),
              strides=(1, 2, 2),
              padding=(0, 3, 3),
              use_bias=False,
          )
          self.bn1 = norm_layer(
              in_channels=45,
              **({} if norm_kwargs is None else norm_kwargs),
          )
          self.relu = nn.Activation("relu")
          self.conv2 = conv3x1x1(in_planes=45, out_planes=64)
          self.bn2 = norm_layer(
              in_channels=64,
              **({} if norm_kwargs is None else norm_kwargs),
          )
  
          if self.partial_bn:
              if norm_kwargs is not None:
                  norm_kwargs["use_global_stats"] = True
              else:
                  norm_kwargs = {}
                  norm_kwargs["use_global_stats"] = True
  
          self.layer1 = self._make_res_layer(
              block=block,
              planes=64,
              blocks=layers[0],
              layer_name="layer1_",
          )
          self.layer2 = self._make_res_layer(
              block=block,
              planes=128,
              blocks=layers[1],
              stride=2,
              layer_name="layer2_",
          )
          self.layer3 = self._make_res_layer(
              block=block,
              planes=256,
              blocks=layers[2],
              stride=2,
              layer_name="layer3_",
          )
          self.layer4 = self._make_res_layer(
              block=block,
              planes=512,
              blocks=layers[3],
              stride=2,
              layer_name="layer4_",
          )
  
          self.avgpool = nn.GlobalAvgPool3D()
          self.dropout = nn.Dropout(rate=self.dropout_ratio)
          self.fc = nn.Dense(
              in_units=self.feat_dim,
              units=nclass,
              weight_initializer=init.Normal(sigma=self.init_std),
          )
  
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 R2Plus1D object from inherited base classes: HybridBlock with example: obj = R2Plus1D(nclass, block, layers, dropout_ratio, num_segments, num_crop, feat_ext, init_std, ctx, partial_bn, norm_layer, norm_kwargs)