class_docstr: Given vector w and token vectors = {t1, t2, ..., t_n}, compute self attention
  weights to weighs the tokens
  * a_j = softmax(w . t_j)
class_docstr_tok: ["Given","vector","w","and","token","vectors","=","{","t1",",","t2",",","...",",","t_n","}",",","compute","self","attention","weights","to","weighs","the","tokens","*","a_j","=","softmax","(","w",".","t_j",")"]
docstr: Input:
      x: batch_size * seq_len * input_dim
      x_mask: batch_size * seq_len (1 for padding, 0 for true)
  Output:
      alpha: batch_size * seq_len
docstr_tok: ["Input",":","x",":","batch_size","*","seq_len","*","input_dim","x_mask",":","batch_size","*","seq_len","(","1","for","padding",",","0","for","true",")","Output",":","alpha",":","batch_size","*","seq_len"]
code: def forward(self, tokens, tokens_mask):
      """
      Input:
          x: batch_size * seq_len * input_dim
          x_mask: batch_size * seq_len (1 for padding, 0 for true)
      Output:
          alpha: batch_size * seq_len
      """
      scores = self.linear(tokens).squeeze(2)
      scores.data.masked_fill_(tokens_mask.data, -float("inf"))
      return F.softmax(scores, dim=-1)
  
file_path: pytext/pytext/models/representations/attention.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from pytext.models.module import Module
  from pytext.utils.usage import log_class_usage
label_desc: Use image node_id 3 for calling the DotProductSelfAttention obj's underlying member method code with example usage: obj.forward(tokens, tokens_mask) and returns: F