class_docstr: Non-local Neural Networks.
  
  This head is the implementation of `NLNet
  <https://arxiv.org/abs/1711.07971>`_.
  
  Args:
      reduction (int): Reduction factor of projection transform. Default: 2.
      use_scale (bool): Whether to scale pairwise_weight by
          sqrt(1/inter_channels). Default: True.
      mode (str): The nonlocal mode. Options are 'embedded_gaussian',
          'dot_product'. Default: 'embedded_gaussian.'.
docstr: Forward function.
docstr_tok: ["Forward","function","."]
code: def forward(self, inputs):
      """Forward function."""
      x = self._transform_inputs(inputs)
      output = self.convs[0](x)
      output = self.nl_block(output)
      output = self.convs[1](output)
      if self.concat_input:
          output = self.conv_cat(torch.cat([x, output], dim=1))
      output = self.cls_seg(output)
      return output
  
file_path: lavis/lavis/common/annotator/uniformer/mmseg/models/decode_heads/nl_head.py
imports: import torch
  from annotator.uniformer.mmcv.cnn import NonLocal2d
  from ..builder import HEADS
  from .fcn_head import FCNHead
label_desc: Use image node_id 2 for calling the NLHead obj's underlying member method code with example usage: obj.forward(inputs) and returns: output