code: def crossentropy(label, logits):
      
  
      assert logits.ndim == 1
  
      # for numerical reasons we subtract the max logit
      # (mathematically it doesn't matter!)
      # otherwise exp(logits) might become too large or too small
      logits = logits - np.max(logits)
      e = np.exp(logits)
      s = np.sum(e)
      ce = np.log(s) - logits[label]
      return ce
docs: Calculates the cross-entropy.
  
      Parameters
      ----------
      logits : array_like
          The logits predicted by the model.
      label : int
          The label describing the target distribution.
  
      Returns
      -------
      float
          The cross-entropy between softmax(logits) and onehot(label).