class_docstr: Categorical DQN.
  
  See https://arxiv.org/abs/1707.06887.
  
  Arguments are the same as those of DQN except q_function must return
  DistributionalDiscreteActionValue and clip_delta is ignored.
class_docstr_tok: ["Categorical","DQN",".","See","https",":","\/\/arxiv.org\/abs\/1707.06887",".","Arguments","are","the","same","as","those","of","DQN","except","q_function","must","return","DistributionalDiscreteActionValue","and","clip_delta","is","ignored","."]
docstr: Compute a loss of categorical DQN.
docstr_tok: ["Compute","a","loss","of","categorical","DQN","."]
code: def _compute_loss(self, exp_batch, errors_out=None):
      """Compute a loss of categorical DQN."""
      y, t = self._compute_y_and_t(exp_batch)
      # Minimize the cross entropy
      # y is clipped to avoid log(0)
      eltwise_loss = -t * F.log(F.clip(y, 1e-10, 1.0))
  
      if errors_out is not None:
          del errors_out[:]
          # The loss per example is the sum of the atom-wise loss
          # Prioritization by KL-divergence
          delta = F.sum(eltwise_loss, axis=1)
          delta = cuda.to_cpu(delta.array)
          for e in delta:
              errors_out.append(e)
  
      if "weights" in exp_batch:
          return compute_weighted_value_loss(
              eltwise_loss,
              y.shape[0],
              exp_batch["weights"],
              batch_accumulator=self.batch_accumulator,
          )
      else:
          return compute_value_loss(
              eltwise_loss, batch_accumulator=self.batch_accumulator
          )
  
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 the CategoricalDQN obj's underlying member method code with example usage: obj._compute_loss(exp_batch, errors_out) and returns: compute_weighted_value_loss, compute_value_loss