code: def masked_avgpool(sent, mask):
      mask_ = mask.masked_fill(mask == 0, -1e9).float()
      score = torch.softmax(mask_, -1)
      return torch.matmul(score.unsqueeze(1), sent).squeeze(1)
  
file_path: DeepKE/example/triple/PRGC/model.py
imports: from collections import Counter
  import torch
  import torch.nn
  from transformers import BertPreTrainedModel, BertModel
label_desc: Use image node_id 2 for calling the BertForRE obj's underlying member method code with example usage: obj.masked_avgpool(sent, mask) and returns: torch