code: def forward(
      self, inputs: torch.Tensor, seq_lengths: torch.Tensor = None
  ) -> torch.Tensor:
      # size: (bsz, sent_len, rep_dim)
      size = torch.onnx.operators.shape_as_tensor(inputs)
  
      flat_2d_shape = torch.cat(
          (torch.LongTensor([-1]), size[2].view(1))
      )
      compressed_emb = torch.onnx.operators.reshape_from_tensor_shape(
          inputs, flat_2d_shape
      )  # (bsz * sent_len, rep_len)
      hbar = self.tanh(
          self.ws1(self.dropout(compressed_emb))
      )  # (bsz * sent_len, attention_dim)
      alphas = self.ws2(hbar)  # (bsz * sent_len, 1)
      alphas = torch.onnx.operators.reshape_from_tensor_shape(
          alphas, size[:2]
      )  # (bsz, sent_len)
      alphas = self.softmax(alphas)  # (bsz, sent_len)
  
      # (bsz, rep_dim)
      return torch.bmm(alphas.unsqueeze(1), inputs).squeeze(1)
  
imports: import torch
  import torch.nn
  import torch.onnx.operators
  from pytext.config import ConfigBase
  from pytext.models.module import Module
  from pytext.utils.usage import log_class_usage
label_desc: Use image node_id 3 for calling the SelfAttention obj's underlying member method code with example usage: obj.forward(inputs, seq_lengths) and returns: torch