class_docstr: ResNe(X)t 3D 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: ["ResNe","(","X",")","t","3D","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 forward(self, inputs):
      assert (
          len(inputs) == self.num_pathways
      ), "Input tensor does not contain {} pathway".format(
          self.num_pathways
      )
      pool_out = []
      for pathway in range(self.num_pathways):
          m = getattr(self, "pathway{}_avgpool".format(pathway))
          pool_out.append(m(inputs[pathway]))
      x = torch.cat(pool_out, 1)
      # (N, C, T, H, W) -> (N, T, H, W, C).
      x = x.permute((0, 2, 3, 4, 1))
      # Perform dropout.
      if hasattr(self, "dropout"):
          x = self.dropout(x)
      if self.detach_final_fc:
          x = x.detach()
      if self.l2norm_feats:
          x = nn.functional.normalize(x, dim=1, p=2)
  
      if (
          x.shape[1:4] == torch.Size([1, 1, 1])
          and self.cfg.MODEL.MODEL_NAME == "ContrastiveModel"
      ):
          x = x.view(x.shape[0], -1)
  
      x_proj = self.projection(x)
  
      time_projs = []
      if self.predictors:
          x_in = x_proj
          for proj in self.predictors:
              time_projs.append(proj(x_in))
  
      if not self.training:
          if self.act is not None:
              x_proj = self.act(x_proj)
          # Performs fully convlutional inference.
          if x_proj.ndim == 5 and x_proj.shape[1:4] > torch.Size(
              [1, 1, 1]
          ):
              x_proj = x_proj.mean([1, 2, 3])
  
      x_proj = x_proj.view(x_proj.shape[0], -1)
  
      if time_projs:
          return [x_proj] + time_projs
      else:
          return x_proj
  
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 ResNetBasicHead obj's underlying member method code with example usage: obj.forward(inputs) and returns: unknown, x_proj