class_docstr: Builds Non-local Neural Networks as a generic family of building
  blocks for capturing long-range dependencies. Non-local Network
  computes the response at a position as a weighted sum of the
  features at all positions. This building block can be plugged into
  many computer vision architectures.
  More details in the paper:
  Wang, Xiaolong, Ross Girshick, Abhinav Gupta, and Kaiming He.
  "Non-local neural networks."
  In Proceedings of the IEEE conference on CVPR, 2018.
code: def __init__(
      self,
      *,
      conv_theta: nn.Module,
      conv_phi: nn.Module,
      conv_g: nn.Module,
      conv_out: nn.Module,
      pool: Optional[nn.Module] = None,
      norm: Optional[nn.Module] = None,
      instantiation: str = "dot_product",
  ) -> None:
      super().__init__()
      set_attributes(self, locals())
      assert None not in (conv_theta, conv_phi, conv_g, conv_out)
      assert instantiation in (
          "dot_product",
          "softmax",
      ), "Unknown norm type {}".format(instantiation)
      assert (
          len(
              {
                  self.conv_theta.out_channels,
                  self.conv_phi.out_channels,
                  self.conv_g.out_channels,
                  self.conv_out.in_channels,
              }
          )
          == 1
      ), "Nonlocal convolution's input/ output dimension mismatch."
  
file_path: pytorchvideo/pytorchvideo/layers/nonlocal_net.py
imports: from typing import Callable, Iterable, Optional, Tuple
  import torch
  import torch.nn
  from pytorchvideo.layers.utils import set_attributes
label_desc: Use image node_id 1 to create a new NonLocal object from inherited base classes: nn with example: obj = NonLocal()