class_docstr: Scaled Dot-Product Attention Module. This code is adopted from
  https://github.com/jadore801120/attention-is-all-you-need-pytorch.
  
  Args:
      temperature (float): The scale factor for softmax input.
      attn_dropout (float): Dropout layer on attn_output_weights.
code: def forward(self, q, k, v, mask=None):
      attn = torch.matmul(q / self.temperature, k.transpose(2, 3))
  
      if mask is not None:
          attn = attn.masked_fill(mask == 0, float("-inf"))
  
      attn = self.dropout(F.softmax(attn, dim=-1))
      output = torch.matmul(attn, v)
  
      return output, attn
  
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from mmocr.registry import MODELS
label_desc: Use image node_id 2 for calling the ScaledDotProductAttention obj's underlying member method code with example usage: obj.forward(q, k, v, mask) and returns: output,  attn