code: def forward(self, decoder_state, source_hids, src_lengths):
      # Reshape to bsz x src_len x context_dim
      source_hids = source_hids.transpose(0, 1)
      # decoder_state: bsz x context_dim
      if self.input_proj is not None:
          decoder_state = self.input_proj(decoder_state)
      # compute attention (bsz x src_len x context_dim) * (bsz x context_dim x 1)
      attn_scores = torch.bmm(
          source_hids, decoder_state.unsqueeze(2)
      ).squeeze(2)
  
      # Mask + softmax (bsz x src_len)
      normalized_masked_attn_scores = masked_softmax(
          attn_scores, src_lengths, self.src_length_masking
      )
  
      # Sum weighted sources
      attn_weighted_context = (
          (source_hids * normalized_masked_attn_scores.unsqueeze(2))
          .contiguous()
          .sum(1)
      )
  
      return attn_weighted_context, normalized_masked_attn_scores.t()
  
imports: from typing import Dict, Optional, Tuple
  import numpy
  import torch
  import torch.nn.functional
  from pytext.config import ConfigBase
  from pytext.utils.usage import log_class_usage
  from torch import nn, Tensor
  from .base import PyTextIncrementalDecoderComponent
  from .utils import Linear
label_desc: Use image node_id 2 for calling the DotAttention obj's underlying member method code with example usage: obj.forward(decoder_state, source_hids, src_lengths) and returns: attn_weighted_context,  normalized_masked_attn_scores