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: https://arxiv.org/pdf/1711.07971.pdf
class_docstr_tok: ["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",":","https",":","\/\/arxiv.org\/pdf\/1711.07971.pdf"]
docstr: Args:
      dim (int): number of dimension for the input.
      dim_inner (int): number of dimension inside of the Non-local block.
      pool_size (list): the kernel size of spatial temporal pooling,
          temporal pool kernel size, spatial pool kernel size, spatial
          pool kernel size in order. By default pool_size is None,
          then there would be no pooling used.
      instantiation (string): supports two different instantiation method:
          "dot_product": normalizing correlation matrix with L2.
          "softmax": normalizing correlation matrix with Softmax.
      zero_init_final_conv (bool): If true, zero initializing the final
          convolution of the Non-local block.
      zero_init_final_norm (bool):
          If true, zero initializing the final batch norm of the Non-local
          block.
      norm_module (nn.Module): nn.Module for the normalization layer. The
          default is nn.BatchNorm3d.
docstr_tok: ["Args",":","dim","(","int",")",":","number","of","dimension","for","the","input",".","dim_inner","(","int",")",":","number","of","dimension","inside","of","the","Non-local","block",".","pool_size","(","list",")",":","the","kernel","size","of","spatial","temporal","pooling",",","temporal","pool","kernel","size",",","spatial","pool","kernel","size",",","spatial","pool","kernel","size","in","order",".","By","default","pool_size","is","None",",","then","there","would","be","no","pooling","used",".","instantiation","(","string",")",":","supports","two","different","instantiation","method",":","``","dot_product","''",":","normalizing","correlation","matrix","with","L2",".","``","softmax","''",":","normalizing","correlation","matrix","with","Softmax",".","zero_init_final_conv","(","bool",")",":","If","true",",","zero","initializing","the","final","convolution","of","the","Non-local","block",".","zero_init_final_norm","(","bool",")",":","If","true",",","zero","initializing","the","final","batch","norm","of","the","Non-local","block",".","norm_module","(","nn.Module",")",":","nn.Module","for","the","normalization","layer",".","The","default","is","nn.BatchNorm3d","."]
code: def __init__(
      self,
      dim,
      dim_inner,
      pool_size=None,
      instantiation="softmax",
      zero_init_final_conv=False,
      zero_init_final_norm=True,
      norm_eps=1e-5,
      norm_momentum=0.1,
      norm_module=nn.BatchNorm3d,
  ):
      """
      Args:
          dim (int): number of dimension for the input.
          dim_inner (int): number of dimension inside of the Non-local block.
          pool_size (list): the kernel size of spatial temporal pooling,
              temporal pool kernel size, spatial pool kernel size, spatial
              pool kernel size in order. By default pool_size is None,
              then there would be no pooling used.
          instantiation (string): supports two different instantiation method:
              "dot_product": normalizing correlation matrix with L2.
              "softmax": normalizing correlation matrix with Softmax.
          zero_init_final_conv (bool): If true, zero initializing the final
              convolution of the Non-local block.
          zero_init_final_norm (bool):
              If true, zero initializing the final batch norm of the Non-local
              block.
          norm_module (nn.Module): nn.Module for the normalization layer. The
              default is nn.BatchNorm3d.
      """
      super(Nonlocal, self).__init__()
      self.dim = dim
      self.dim_inner = dim_inner
      self.pool_size = pool_size
      self.instantiation = instantiation
      self.use_pool = (
          False
          if pool_size is None
          else any((size > 1 for size in pool_size))
      )
      self.norm_eps = norm_eps
      self.norm_momentum = norm_momentum
      self._construct_nonlocal(
          zero_init_final_conv, zero_init_final_norm, norm_module
      )
  
imports: import torch
  import torch.nn
label_desc: Use image node_id 1 to create a new Nonlocal object from inherited base classes: nn with example: obj = Nonlocal(dim, dim_inner, pool_size, instantiation, zero_init_final_conv, zero_init_final_norm, norm_eps, norm_momentum, norm_module)