class_docstr: Soft Dot Attention.
  
  Ref: http://www.aclweb.org/anthology/D15-1166
  Adapted from PyTorch OPEN NMT.
class_docstr_tok: ["Soft","Dot","Attention",".","Ref",":","http",":","\/\/www.aclweb.org\/anthology\/D15-1166","Adapted","from","PyTorch","OPEN","NMT","."]
docstr: Initialize layer.
docstr_tok: ["Initialize","layer","."]
code: def __init__(self, dim):
      """Initialize layer."""
      super(SoftDotAttention, self).__init__()
      self.linear_in = nn.Linear(dim, dim, bias=False)
      self.sm = nn.Softmax(dim=1)
      self.linear_out = nn.Linear(dim * 2, dim, bias=False)
      self.tanh = nn.Tanh()
      self.mask = None
  
imports: import logging
  import torch
  import torch.nn
  import math
  import numpy
  import stanza.models.common.seq2seq_constant
label_desc: Use image node_id 1 to create a new SoftDotAttention object from inherited base classes: nn with example: obj = SoftDotAttention(dim)