code: def weighted_avg(x, weights):
      """x = batch * len * d
      weights = batch * len
      """
      return weights.unsqueeze(1).bmm(x).squeeze(1)
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from torch.autograd import Variable
  import sru
label_desc: Use image node_id 2 for calling a global function with example usage: weighted_avg(x, weights) and returns: weights