code: def _sparse_softmax_cross_entropy_with_logits(  # pylint: disable=invalid-name,unused-argument
      labels, logits, name=None
  ):
      """Sparse Softmax cross entropy with logits."""
      labels_shape = labels.shape
      num_classes = logits.shape[-1]
      logits = np.reshape(logits, [-1, num_classes])
      labels = np.reshape(labels, [-1])
  
      labels = numpy_array.one_hot(labels, num_classes)
  
      cost = -np.sum(
          np.where(
              labels == 0,
              np.zeros_like(labels),
              labels
              * (
                  logits
                  - reduce_logsumexp(logits, axis=-1, keepdims=True)
              ),
          ),
          axis=-1,
      )
      cost = np.reshape(cost, labels_shape)
      return cost
  
file_path: probability/tensorflow_probability/python/internal/backend/numpy/nn.py
imports: import collections
  import numpy
  from tensorflow_probability.python.internal.backend.numpy import _utils
  from tensorflow_probability.python.internal.backend.numpy import numpy_array
  from tensorflow_probability.python.internal.backend.numpy.numpy_math import l2_normalize
  from tensorflow_probability.python.internal.backend.numpy.numpy_math import log_softmax
  from tensorflow_probability.python.internal.backend.numpy.numpy_math import reduce_logsumexp
  from tensorflow_probability.python.internal.backend.numpy.numpy_math import reduce_mean
  from tensorflow_probability.python.internal.backend.numpy.numpy_math import softmax
  from tensorflow_probability.python.internal.backend.numpy.numpy_math import softplus
  from tensorflow_probability.python.internal.backend.numpy.numpy_math import squared_difference
  from tensorflow_probability.python.internal.backend.numpy.numpy_math import top_k
  from tensorflow_probability.python.internal.backend.numpy.ops import stop_gradient
label_desc: Use image node_id 4 for calling a global function with example usage: _sparse_softmax_cross_entropy_with_logits(labels, logits, name) and returns: cost