class_docstr: Softmax activation followed by a cross entropy loss.
class_docstr_tok: ["Softmax","activation","followed","by","a","cross","entropy","loss","."]
code: def _soft_target_loss(self, xp, x, t, log_y):
      if self.soft_target_loss == "kl-divergence":
          ret = xp.sum(t * (xp.log(t + self.eps) - log_y), axis=1)
      else:
          ret = -xp.sum(t * log_y, axis=1)
      if self.reduce == "mean":
          self._coeff = 1.0 / (x.size / x.shape[1])
          ret = ret.sum(keepdims=True) * self._coeff
          return (ret.reshape(()),)
      else:
          return (ret,)
  
imports: import numpy
  import six
  import chainer
  from chainer import backend
  from chainer.backends import cuda
  from chainer import function_node
  from chainer.functions.activation import log_softmax
  from chainer.utils import type_check
  from chainer import variable
  import chainerx
label_desc: Use image node_id 7 for calling the SoftmaxCrossEntropy obj's underlying member method code with example usage: obj._soft_target_loss(xp, x, t, log_y) and returns: ret, ret