code: def categorical_crossentropy(y_pred, y_true):
      """Categorical Crossentropy.
  
      Computes cross entropy between y_pred (logits) and y_true (labels).
  
      Measures the probability error in discrete classification tasks in which
      the classes are mutually exclusive (each entry is in exactly one class).
      For example, each CIFAR-10 image is labeled with one and only one label:
      an image can be a dog or a truck, but not both.
  
      `y_pred` and `y_true` must have the same shape `[batch_size, num_classes]`
      and the same dtype (either `float32` or `float64`). It is also required
      that `y_true` (labels) are binary arrays (For example, class 2 out of a
      total of 5 different classes, will be define as [0., 1., 0., 0., 0.])
  
      Arguments:
          y_pred: `Tensor`. Predicted values.
          y_true: `Tensor` . Targets (labels), a probability distribution.
  
      """
      with tf.name_scope("Crossentropy"):
          y_pred /= tf.reduce_sum(
              y_pred,
              reduction_indices=len(y_pred.get_shape()) - 1,
              keepdims=True,
          )
          # manual computation of crossentropy
          y_pred = tf.clip_by_value(
              y_pred,
              tf.cast(_EPSILON, dtype=_FLOATX),
              tf.cast(1.0 - _EPSILON, dtype=_FLOATX),
          )
          cross_entropy = -tf.reduce_sum(
              y_true * tf.log(y_pred),
              reduction_indices=len(y_pred.get_shape()) - 1,
          )
          return tf.reduce_mean(cross_entropy)
  
file_path: tflearn/tflearn/objectives.py
imports: from __future__ import division, print_function, absolute_import
  import tensorflow.compat.v1
  from .config import _EPSILON, _FLOATX
  from .utils import get_from_module
label_desc: Use image node_id 3 for calling a global function with example usage: categorical_crossentropy(y_pred, y_true) and returns: tf