class_docstr: Self attention over a sequence:
  * o_i = softmax(Wx_i) for x_i in X.
docstr: x = batch * len * hdim
  x_mask = batch * len
docstr_tok: ["x","=","batch","*","len","*","hdim","x_mask","=","batch","*","len"]
code: def forward(self, x, x_mask):
      """
      x = batch * len * hdim
      x_mask = batch * len
      """
      x_flat = x.view(-1, x.size(-1))
      scores = self.linear(x_flat).view(x.size(0), x.size(1))
      scores.data.masked_fill_(x_mask.data, -float("inf"))
      alpha = F.softmax(scores)
      return alpha
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from torch.autograd import Variable
  import sru
label_desc: Use image node_id 2 for calling the LinearSeqAttn obj's underlying member method code with example usage: obj.forward(x, x_mask) and returns: alpha