code: def batched_weighted_sum(weights, vecs, batch_size):
      """Compute the gradients for updating the parameters.
      Args:
          weights(np.array): the nomalized rewards computed by the function `compute_centered_ranks`.
          vecs(np.array): the noise added to the parameters.
          batch_size(int): the batch_size for speeding up the computation.
      Return:
      total(np.array): aggregated gradient.
      """
      total = 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),
          )
      return total
  
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