chainerx.softmax_cross_entropy

chainerx.softmax_cross_entropy(x1, x2)

Element-wise cross entropy loss for pre-softmax activations.

Parameters
  • x1 (ndarray) – An array whose element indicates unnormalized log probability: the first axis of the array represents the number of samples, and the second axis represents the number of classes.

  • x2 (ndarray) – A signed integer vector of ground truth labels. If x2[i] == -1, corresponding x1[i] is ignored.

Returns

An array of the cross entropy.

Return type

ndarray

Note

During backpropagation, this function propagates the gradient of the output array to the input array x1 only.