class_docstr: Disentangled Non-Local Neural Networks.
  
  This head is the implementation of `DNLNet
  <https://arxiv.org/abs/2006.06668>`_.
  
  Args:
      reduction (int): Reduction factor of projection transform. Default: 2.
      use_scale (bool): Whether to scale pairwise_weight by
          sqrt(1/inter_channels). Default: False.
      mode (str): The nonlocal mode. Options are 'embedded_gaussian',
          'dot_product'. Default: 'embedded_gaussian.'.
      temperature (float): Temperature to adjust attention. Default: 0.05
class_docstr_tok: ["Disentangled","Non-Local","Neural","Networks",".","This","head","is","the","implementation","of","`","DNLNet","<","https",":","\/\/arxiv.org\/abs\/2006.06668",">","`","_",".","Args",":","reduction","(","int",")",":","Reduction","factor","of","projection","transform",".","Default",":","2.","use_scale","(","bool",")",":","Whether","to","scale","pairwise_weight","by","sqrt","(","1\/inter_channels",")",".","Default",":","False",".","mode","(","str",")",":","The","nonlocal","mode",".","Options","are","'embedded_gaussian","'",",","'dot_product","'",".","Default",":","'embedded_gaussian.","'",".","temperature","(","float",")",":","Temperature","to","adjust","attention",".","Default",":","0.05"]
code: def __init__(
      self,
      reduction=2,
      use_scale=True,
      mode="embedded_gaussian",
      temperature=0.05,
      **kwargs,
  ):
      super(DNLHead, self).__init__(num_convs=2, **kwargs)
      self.reduction = reduction
      self.use_scale = use_scale
      self.mode = mode
      self.temperature = temperature
      self.dnl_block = DisentangledNonLocal2d(
          in_channels=self.channels,
          reduction=self.reduction,
          use_scale=self.use_scale,
          conv_cfg=self.conv_cfg,
          norm_cfg=self.norm_cfg,
          mode=self.mode,
          temperature=self.temperature,
      )
  
file_path: lavis/lavis/common/annotator/uniformer/mmseg/models/decode_heads/dnl_head.py
imports: import torch
  from annotator.uniformer.mmcv.cnn import NonLocal2d
  from torch import nn
  from ..builder import HEADS
  from .fcn_head import FCNHead
label_desc: Use image node_id 1 to create a new DNLHead object from inherited base classes: FCNHead with example: obj = DNLHead(reduction, use_scale, mode, temperature)