code: def crossentropy(predictions, labels, logits=True):
      """Calculates the crossentropy loss between predictions and labels
  
      Args:
          prediction (np.ndarray): predictions
          labels (np.ndarray): labels
          logits (bool): flag whether predictions are logits or probabilities
  
      Returns:
          float: crossentropy error
      """
  
      if logits:
          maxes = np.amax(predictions, axis=-1, keepdims=True)
          softexp = np.exp(predictions - maxes)
          softm = softexp / np.sum(softexp, axis=-1, keepdims=True)
      else:
          softm = predictions
      loss = np.mean(
          -1.0 * np.sum(labels * np.log(softm + 1e-8), axis=-1)
      )
      return loss.astype(np.float32)
  
imports: from __future__ import division
  from __future__ import absolute_import
  from __future__ import print_function
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: crossentropy(predictions, labels, logits) and returns: loss