code: def __init__(
      self,
      query_size,
      memory_size,
      hidden_size,
      has_bias=False,
      dropout=0.2,
      attention_funtion="mlp",
  ):
      super(Attention, self).__init__()
      self.query_size = query_size
      self.memory_size = memory_size
      self.hidden_size = hidden_size
      self.attn_type = attention_funtion
      self.dropout = nn.Dropout(dropout)
      assert self.attn_type in ["mlp", "general", "dot"]
      if self.attn_type == "mlp":
          self.query_in = nn.Linear(
              self.query_size,
              self.hidden_size,
              bias=True if has_bias else False,
          )
          self.memory_in = nn.Linear(
              self.memory_size, self.hidden_size, bias=False
          )
      elif self.attn_type == "dot":
          if memory_size != query_size:
              raise ValueError(
                  'Parameter "memory_size" must be equal to "query_size"'
              )
      elif self.attn_type == "general":
          self.query2memory = nn.Linear(
              query_size, memory_size, bias=False
          )
      self.out = nn.Linear(self.hidden_size, 1, bias=False)
      self.inf = 1e8
  
imports: import torch
  import torch.nn
label_desc: Use image node_id 1 to create a new Attention object from inherited base classes: nn with example: obj = Attention(query_size, memory_size, hidden_size, has_bias, dropout, attention_funtion)