code: def batched_weighted_sum(weights, vecs, batch_size):
      total = 0
      num_items_summed = 0
      for batch_weights, batch_vecs in zip(
          itergroups(weights, batch_size), itergroups(vecs, batch_size)
      ):
          assert len(batch_weights) == len(batch_vecs) <= batch_size
          total += np.dot(
              np.asarray(batch_weights, dtype=np.float32),
              np.asarray(batch_vecs, dtype=np.float32),
          )
          num_items_summed += len(batch_weights)
      return total, num_items_summed
  
imports: import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: batched_weighted_sum(weights, vecs, batch_size) and returns: total,  num_items_summed