class_docstr: Implementation of SelfAttentionPooling 
  Original Paper: Self-Attention Encoding and Pooling for Speaker Recognition
  https://arxiv.org/pdf/2008.01077v1.pdf
  Taken from: https://gist.github.com/pohanchi/c77f6dbfbcbc21c5215acde4f62e4362
docstr: input:
      batch_rep : size (N, T, H), N: batch size, T: sequence length, H: Hidden dimension
  
  attention_weight:
      att_w : size (N, T, 1)
  
  return:
      utter_rep: size (N, H)
docstr_tok: ["input",":","batch_rep",":","size","(","N",",","T",",","H",")",",","N",":","batch","size",",","T",":","sequence","length",",","H",":","Hidden","dimension","attention_weight",":","att_w",":","size","(","N",",","T",",","1",")","return",":","utter_rep",":","size","(","N",",","H",")"]
code: def forward(self, batch_rep):
      """
      input:
          batch_rep : size (N, T, H), N: batch size, T: sequence length, H: Hidden dimension
  
      attention_weight:
          att_w : size (N, T, 1)
  
      return:
          utter_rep: size (N, H)
      """
      softmax = nn.functional.softmax
      att_w = softmax(self.W(batch_rep).squeeze(-1), dim=1).unsqueeze(
          -1
      )
      utter_rep = torch.sum(batch_rep * att_w, dim=1)
  
      return utter_rep
  
imports: import math
  import numpy
  import torch
  import torch.nn
  from torch.cuda.amp import custom_bwd, custom_fwd
label_desc: Use image node_id 2 for calling the SelfAttentionPooling obj's underlying member method code with example usage: obj.forward(batch_rep) and returns: utter_rep