code: def forward(self, x, mask):
      x = torch.sum(x, 2)
      length = torch.sum(mask, 1, keepdim=True).float()
      length += torch.eq(length, 0.0).float() * EPS
      length = length.repeat(1, x.size()[1])
      x /= length
      return x
  
file_path: nni/examples/nas/legacy/textnas/utils.py
imports: import logging
  import torch
  import torch.nn
label_desc: Use image node_id 1 for calling the GlobalAvgPool obj's underlying member method code with example usage: obj.forward(x, mask) and returns: x