class_docstr: 这是一个基于论文 `A structured self-attentive sentence embedding <https://arxiv.org/pdf/1703.03130.pdf>`_
  的 **Self Attention Module** 。
  
  :param  input_size: 输入 tensor 的 hidden 维度
  :param attention_unit: 输出 tensor 的 hidden 维度
  :param attention_hops:
  :param drop: dropout 概率
class_docstr_tok: ["\u8fd9\u662f\u4e00\u4e2a\u57fa\u4e8e\u8bba\u6587","`","A","structured","self-attentive","sentence","embedding","<","https",":","\/\/arxiv.org\/pdf\/1703.03130.pdf",">","`","_","\u7684","*","*","Self","Attention","Module","*","*","\u3002",":","param","input_size",":","\u8f93\u5165","tensor","\u7684","hidden","\u7ef4\u5ea6",":","param","attention_unit",":","\u8f93\u51fa","tensor","\u7684","hidden","\u7ef4\u5ea6",":","param","attention_hops",":",":","param","drop",":","dropout","\u6982\u7387"]
code: def __init__(
      self, input_size, attention_unit=300, attention_hops=10, drop=0.5
  ):
      super(SelfAttention, self).__init__()
  
      self.attention_hops = attention_hops
      self.ws1 = nn.Linear(input_size, attention_unit, bias=False)
      self.ws2 = nn.Linear(attention_unit, attention_hops, bias=False)
      self.I = torch.eye(attention_hops, requires_grad=False)
      self.I_origin = self.I
      self.drop = nn.Dropout(drop)
      self.tanh = nn.Tanh()
  
imports: import math
  import torch
  import torch.nn.functional
  from torch import nn
  from .decoder.seq2seq_state import TransformerState
label_desc: Use image node_id 1 to create a new SelfAttention object from inherited base classes: nn with example: obj = SelfAttention(input_size, attention_unit, attention_hops, drop)