class_docstr: This function implements a self-attention pooling (https://arxiv.org/abs/2008.01077).
  
  Arguments
  ---------
  input_dim: int
      The dimension of the input Tensor
  
  Example
  -------
  >>> inp_tensor = torch.rand([4, 40])
  >>> pool = AttentionPooling(input_dim=40)
  >>> out_tensor = pool(inp_tensor)
docstr: Returns the output the adapter.
  
  Arguments
  ---------
  x : torch.Tensor
      Input tensor.
docstr_tok: ["Returns","the","output","the","adapter",".","Arguments","--","--","--","--","-","x",":","torch.Tensor","Input","tensor","."]
code: def forward(self, x):
      """Returns the output the adapter.
  
      Arguments
      ---------
      x : torch.Tensor
          Input tensor.
      """
      out = self.attn_pooling_w(x).squeeze(-1).float()
      out = torch.nn.functional.softmax(out, dim=-1).unsqueeze(-1)
      out = torch.sum(x * out, dim=1)
      return out
  
imports: import torch
  import logging
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 2 for calling the AttentionPooling obj's underlying member method code with example usage: obj.forward(x) and returns: out