code: def attention_weighted_src_embedding(
      src_embedding, attn_scores, activation_fn=torch.tanh
  ):
      """
      use the attention weights to form a weighted average of embeddings
      parameters:
          src_embedding:  srclen x bsz x embeddim
          attn_scores: bsz x tgtlen x srclen
      return:
          lex: bsz x tgtlen x embeddim
      """
      # lexical choice varying lengths: T x B x C -> B x T x C
      src_embedding = src_embedding.transpose(0, 1)
  
      lex = torch.bmm(attn_scores, src_embedding)
      lex = activation_fn(lex)
      return lex
  
label_desc: Use image node_id 1 for calling a global function with example usage: attention_weighted_src_embedding(src_embedding, attn_scores, activation_fn) and returns: lex