class_docstr: A basic MLP attention layer.
class_docstr_tok: ["A","basic","MLP","attention","layer","."]
code: def __init__(self, dim):
      super(BasicAttention, self).__init__()
      self.linear_in = nn.Linear(dim, dim, bias=False)
      self.linear_c = nn.Linear(dim, dim)
      self.linear_v = nn.Linear(dim, 1, bias=False)
      self.linear_out = nn.Linear(dim * 2, dim, bias=False)
      self.tanh = nn.Tanh()
      self.sm = nn.Softmax(dim=1)
  
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 BasicAttention object from inherited base classes: nn with example: obj = BasicAttention(dim)