class_docstr: Disentangled Non-Local Blocks.
  
  Args:
      temperature (float): Temperature to adjust attention. Default: 0.05
class_docstr_tok: ["Disentangled","Non-Local","Blocks",".","Args",":","temperature","(","float",")",":","Temperature","to","adjust","attention",".","Default",":","0.05"]
docstr: Embedded gaussian with temperature.
docstr_tok: ["Embedded","gaussian","with","temperature","."]
code: def embedded_gaussian(self, theta_x, phi_x):
      """Embedded gaussian with temperature."""
  
      # NonLocal2d pairwise_weight: [N, HxW, HxW]
      pairwise_weight = torch.matmul(theta_x, phi_x)
      if self.use_scale:
          # theta_x.shape[-1] is `self.inter_channels`
          pairwise_weight /= theta_x.shape[-1] ** 0.5
      pairwise_weight /= self.temperature
      pairwise_weight = pairwise_weight.softmax(dim=-1)
      return pairwise_weight
  
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 2 for calling the DisentangledNonLocal2d obj's underlying member method code with example usage: obj.embedded_gaussian(theta_x, phi_x) and returns: pairwise_weight