class_docstr: ResNet basic head. This layer performs an optional pooling operation followed by an
  optional dropout, a fully-connected projection, an optional activation layer and a
  global spatiotemporal averaging.
  
  ::
  
                                      Pool3d
                                         ↓
                                      Dropout
                                         ↓
                                     Projection
                                         ↓
                                     Activation
                                         ↓
                                     Averaging
  
  The builder can be found in `create_res_basic_head`.
class_docstr_tok: ["ResNet","basic","head",".","This","layer","performs","an","optional","pooling","operation","followed","by","an","optional","dropout",",","a","fully-connected","projection",",","an","optional","activation","layer","and","a","global","spatiotemporal","averaging",".",":",":","Pool3d","\u2193","Dropout","\u2193","Projection","\u2193","Activation","\u2193","Averaging","The","builder","can","be","found","in","`","create_res_basic_head","`","."]
code: def forward(self, x: torch.Tensor) -> torch.Tensor:
      # Performs pooling.
      if self.pool is not None:
          x = self.pool(x)
      # Performs dropout.
      if self.dropout is not None:
          x = self.dropout(x)
      # Performs projection.
      if self.proj is not None:
          x = x.permute((0, 2, 3, 4, 1))
          x = self.proj(x)
          x = x.permute((0, 4, 1, 2, 3))
      # Performs activation.
      if self.activation is not None:
          x = self.activation(x)
  
      if self.output_pool is not None:
          # Performs global averaging.
          x = self.output_pool(x)
          x = x.view(x.shape[0], -1)
      return x
  
imports: from typing import Callable, Tuple
  import torch
  import torch.nn
  from pytorchvideo.layers.utils import set_attributes
  from torchvision.ops import RoIAlign
label_desc: Use image node_id 2 for calling the ResNetBasicHead obj's underlying member method code with example usage: obj.forward(x) and returns: x