code: def compute_weighted_value_loss(
      eltwise_loss, batch_size, weights, batch_accumulator="mean"
  ):
      """Compute a loss for value prediction problem.
  
      Args:
          eltwise_loss (Variable): Element-wise loss per example per atom
          weights (ndarray): Weights for y, t.
          batch_accumulator (str): 'mean' will divide loss by batchsize
      Returns:
          (Variable) scalar loss
      """
      assert batch_accumulator in ("mean", "sum")
  
      # eltwise_loss is (batchsize, n_atoms) array of losses
      # weights is an array of shape (batch_size)
      # sum loss across atoms and then apply weight per example in batch
      loss_sum = F.matmul(F.sum(eltwise_loss, axis=1), weights)
      if batch_accumulator == "mean":
          loss = loss_sum / batch_size
      elif batch_accumulator == "sum":
          loss = loss_sum
      return loss
  
file_path: chainerrl/chainerrl/agents/categorical_dqn.py
imports: import chainer
  from chainer import cuda
  import chainer.functions
  import numpy
  from chainerrl.agents import dqn
label_desc: Use image node_id 3 for calling a global function with example usage: compute_weighted_value_loss(eltwise_loss, batch_size, weights, batch_accumulator) and returns: loss