class_docstr: The R2+1D network.
  A Closer Look at Spatiotemporal Convolutions for Action Recognition.
  CVPR, 2018. https://arxiv.org/abs/1711.11248
class_docstr_tok: ["The","R2+1D","network",".","A","Closer","Look","at","Spatiotemporal","Convolutions","for","Action","Recognition",".","CVPR",",","2018.","https",":","\/\/arxiv.org\/abs\/1711.11248"]
code: def __init__(
      self,
      num_classes,
      block,
      layers,
      dropout_ratio=0.5,
      num_segment=1,
      num_crop=1,
      feat_ext=False,
      init_std=0.001,
      partial_bn=False,
      norm_layer=BatchNorm3d,
      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_segment = num_segment
      self.num_crop = num_crop
      self.feat_ext = feat_ext
      self.inplanes = 64
      self.feat_dim = 512 * block.expansion
  
      self.conv1 = nn.Conv3d(
          in_channels=3,
          out_channels=45,
          kernel_size=(1, 7, 7),
          stride=(1, 2, 2),
          padding=(0, 3, 3),
          bias=False,
      )
      self.bn1 = norm_layer(
          num_features=45,
          **({} if norm_kwargs is None else norm_kwargs),
      )
      self.relu = nn.ReLU(inplace=True)
      self.conv2 = conv3x1x1(in_planes=45, out_planes=64)
      self.bn2 = norm_layer(
          num_features=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.AdaptiveAvgPool3d(output_size=(1, 1, 1))
      self.dropout = nn.Dropout(self.dropout_ratio)
      self.fc = nn.Linear(
          in_features=self.feat_dim, out_features=num_classes
      )
      nn.init.normal_(self.fc.weight, 0, self.init_std)
      nn.init.constant_(self.fc.bias, 0)
  
imports: import torch
  import torch.nn
  from torch.nn import BatchNorm3d
label_desc: Use image node_id 1 to create a new R2Plus1D object from inherited base classes: nn with example: obj = R2Plus1D(num_classes, block, layers, dropout_ratio, num_segment, num_crop, feat_ext, init_std, partial_bn, norm_layer, norm_kwargs)