class_docstr: Softmax activation followed by a cross entropy loss.
class_docstr_tok: ["Softmax","activation","followed","by","a","cross","entropy","loss","."]
code: def forward_cpu(self, inputs):
      class_weight = backend.from_chx(self.class_weight)
  
      self.retain_inputs((0, 1))
      x, t = inputs
      if x.ndim == t.ndim and x.shape == t.shape:
          self.soft_target = True
      if chainer.is_debug() and not self.soft_target:
          _check_input_values(x, t, self.ignore_label)
  
      log_y = log_softmax._log_softmax(x)
      if self.cache_score:
          self.y = numpy.exp(log_y)
  
      if self.soft_target:
          return self._soft_target_loss(numpy, x, t, log_y)
  
      if class_weight is not None:
          shape = [1 if d != 1 else -1 for d in six.moves.range(x.ndim)]
          log_y *= _broadcast_to(class_weight.reshape(shape), x.shape)
      log_yd = numpy.rollaxis(log_y, 1)
      log_yd = log_yd.reshape(len(log_yd), -1)
      t_valid = t != self.ignore_label
      t = t * t_valid
      log_p = log_yd[t.ravel(), numpy.arange(t.size)]
  
      log_p *= t_valid.ravel()
      if self.reduce == "mean":
          if self.normalize:
              count = t_valid.sum()
          else:
              count = len(x)
          self._coeff = 1.0 / max(count, 1)
  
          # Perform reduction in a promoted dtype
          reduc_dtype = _reduction_dtype(x.dtype)
          y = log_p.sum(keepdims=True, dtype=reduc_dtype)
          y = y * (-self._coeff)
          y = y.astype(x.dtype, copy=False)
          return (y.reshape(()),)
      else:
          return (-log_p.reshape(t.shape),)
  
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 5 for calling the SoftmaxCrossEntropy obj's underlying member method code with example usage: obj.forward_cpu(inputs) and returns: self, y, unknown