class_docstr: Conv attention takes a key matrix, a value matrix and a query vector.
  Attention weight is calculated by key matrix with the query vector
  and sum on the value matrix. And the same operation is applied
  in each decode conv layer.
docstr: Args:
      base_target_emb: target emb tensor
          ``(batch, channel, height, width)``
      input_from_dec: output of dec conv
          ``(batch, channel, height, width)``
      encoder_out_top: the key matrix for calc of attention weight,
          which is the top output of encode conv
      encoder_out_combine:
          the value matrix for the attention-weighted sum,
          which is the combination of base emb and top output of encode
code: def forward(
      self,
      base_target_emb,
      input_from_dec,
      encoder_out_top,
      encoder_out_combine,
  ):
      """
      Args:
          base_target_emb: target emb tensor
              ``(batch, channel, height, width)``
          input_from_dec: output of dec conv
              ``(batch, channel, height, width)``
          encoder_out_top: the key matrix for calc of attention weight,
              which is the top output of encode conv
          encoder_out_combine:
              the value matrix for the attention-weighted sum,
              which is the combination of base emb and top output of encode
      """
  
      preatt = seq_linear(self.linear_in, input_from_dec)
      target = (base_target_emb + preatt) * SCALE_WEIGHT
      target = torch.squeeze(target, 3)
      target = torch.transpose(target, 1, 2)
  
      pre_attn = torch.bmm(target, encoder_out_top)
  
      if self.mask is not None:
          pre_attn.data.masked_fill_(self.mask, -float("inf"))
  
      attn = F.softmax(pre_attn, dim=2)
  
      context_output = torch.bmm(
          attn, torch.transpose(encoder_out_combine, 1, 2)
      )
      context_output = torch.transpose(
          torch.unsqueeze(context_output, 3), 1, 2
      )
      return context_output, attn
  
file_path: OpenNMT-py/onmt/modules/conv_multi_step_attention.py
imports: import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 3 for calling the ConvMultiStepAttention obj's underlying member method code with example usage: obj.forward(base_target_emb, input_from_dec, encoder_out_top, encoder_out_combine) and returns: context_output,  attn