code: def Weighted_GAP(supp_feat, mask):
      supp_feat = supp_feat * mask
      feat_h, feat_w = supp_feat.shape[-2:][0], supp_feat.shape[-2:][1]
      area = (
          F.avg_pool2d(mask, (supp_feat.size()[2], supp_feat.size()[3]))
          * feat_h
          * feat_w
          + 0.0005
      )
      supp_feat = (
          F.avg_pool2d(
              input=supp_feat, kernel_size=supp_feat.shape[-2:]
          )
          * feat_h
          * feat_w
          / area
      )
      return supp_feat
  
file_path: pfe-net/model/PFENet.py
imports: import torch
  from torch import nn
  import torch.nn.functional
  import numpy
  import random
  import time
  import cv2
  import model.resnet
  import model.vgg
label_desc: Use image node_id 1 for calling a global function with example usage: Weighted_GAP(supp_feat, mask) and returns: supp_feat