class_docstr: Non-local module from Non-local Neural Networks
  CVPR 2018, https://arxiv.org/abs/1711.07971
  
  Args:
      in_channels (int): Channels of the input feature map.
      nonlocal_type (str): Types of design for non-local block,
                           such as 'gaussian', 'dot' and 'concat'.
      dim (int): 2D or 3D non-local block..
      embed_dim (int): Channels of the intermediate feature map,
                       usually are half of the in_channels.
      sub_sample (bool): Default: False. Whether to apply max pooling after pairwise
                         function (Note that the `sub_sample` is applied on spatial only).
      use_bn (bool): Default: True. Whether to use a batch normalization layer
                     inside a non-local block.
class_docstr_tok: ["Non-local","module","from","Non-local","Neural","Networks","CVPR","2018",",","https",":","\/\/arxiv.org\/abs\/1711.07971","Args",":","in_channels","(","int",")",":","Channels","of","the","input","feature","map",".","nonlocal_type","(","str",")",":","Types","of","design","for","non-local","block",",","such","as","'gaussian","'",",","'dot","'","and","'concat","'",".","dim","(","int",")",":","2D","or","3D","non-local","block","..","embed_dim","(","int",")",":","Channels","of","the","intermediate","feature","map",",","usually","are","half","of","the","in_channels",".","sub_sample","(","bool",")",":","Default",":","False",".","Whether","to","apply","max","pooling","after","pairwise","function","(","Note","that","the","`","sub_sample","`","is","applied","on","spatial","only",")",".","use_bn","(","bool",")",":","Default",":","True",".","Whether","to","use","a","batch","normalization","layer","inside","a","non-local","block","."]
code: def init_weights(self, std=0.01, zeros_init=True):
      if self.nonlocal_type != "gaussian":
          for m in [self.g, self.theta, self.phi]:
              normal_init(m, std=std)
      else:
          normal_init(self.g, std=std)
  
      # Zero init the last conv layer (or BN layer if there is) to ensure that the
      # initial state of the entire non-local block is an identity mapping,
      # so it can be inserted into any pre-trained networks while maintaining its initial behavior
      if zeros_init:
          if self.use_bn:
              constant_init(self.bn, 0)
          else:
              constant_init(self.W, 0)
      else:
          if self.use_bn:
              normal_init(self.bn, std=std)
          else:
              normal_init(self.W, std=std)
  
file_path: gluon-cv/gluoncv/torch/model_zoo/action_recognition/non_local.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from torch.nn import BatchNorm3d
  from ...utils.utils import constant_init, normal_init
label_desc: Use image node_id 2 for calling the NonLocal obj's underlying member method code with example usage: obj.init_weights(std, zeros_init) without return types