class_docstr: X3D head.
  This layer performs a fully-connected projection during training, when the
  input size is 1x1x1. It performs a convolutional projection during testing
  when the input size is larger than 1x1x1. If the inputs are from multiple
  different pathways, the inputs will be concatenated after pooling.
class_docstr_tok: ["X3D","head",".","This","layer","performs","a","fully-connected","projection","during","training",",","when","the","input","size","is","1x1x1",".","It","performs","a","convolutional","projection","during","testing","when","the","input","size","is","larger","than","1x1x1",".","If","the","inputs","are","from","multiple","different","pathways",",","the","inputs","will","be","concatenated","after","pooling","."]
code: def _construct_head(self, dim_in, dim_inner, dim_out, norm_module):
      self.conv_5 = nn.Conv3d(
          dim_in,
          dim_inner,
          kernel_size=(1, 1, 1),
          stride=(1, 1, 1),
          padding=(0, 0, 0),
          bias=False,
      )
      self.conv_5_bn = norm_module(
          num_features=dim_inner, eps=self.eps, momentum=self.bn_mmt
      )
      self.conv_5_relu = nn.ReLU(self.inplace_relu)
  
      if self.pool_size is None:
          self.avg_pool = nn.AdaptiveAvgPool3d((1, 1, 1))
      else:
          self.avg_pool = nn.AvgPool3d(self.pool_size, stride=1)
  
      self.lin_5 = nn.Conv3d(
          dim_inner,
          dim_out,
          kernel_size=(1, 1, 1),
          stride=(1, 1, 1),
          padding=(0, 0, 0),
          bias=False,
      )
      if self.bn_lin5_on:
          self.lin_5_bn = norm_module(
              num_features=dim_out, eps=self.eps, momentum=self.bn_mmt
          )
      self.lin_5_relu = nn.ReLU(self.inplace_relu)
  
      if self.dropout_rate > 0.0:
          self.dropout = nn.Dropout(self.dropout_rate)
      # Perform FC in a fully convolutional manner. The FC layer will be
      # initialized with a different std comparing to convolutional layers.
      self.projection = nn.Linear(dim_out, self.num_classes, bias=True)
  
      # Softmax for evaluation and testing.
      if self.act_func == "softmax":
          self.act = nn.Softmax(dim=4)
      elif self.act_func == "sigmoid":
          self.act = nn.Sigmoid()
      else:
          raise NotImplementedError(
              "{} is not supported as an activation"
              "function.".format(self.act_func)
          )
  
imports: from functools import partial
  import torch
  import torch.nn
  from detectron2.layers import ROIAlign
  import slowfast.utils.logging
  from slowfast.models.attention import MultiScaleBlock
  from slowfast.models.batchnorm_helper import NaiveSyncBatchNorm1d
  from slowfast.models.nonlocal_helper import Nonlocal
label_desc: Use image node_id 2 for calling the X3DHead obj's underlying member method code with example usage: obj._construct_head(dim_in, dim_inner, dim_out, norm_module) without return types