code: def get_grad(
      self, guesses: Floats2d, truths: IntsOrFloatsOrStrs
  ) -> Floats2d:
      target, mask = self.convert_truths(truths, guesses)
      xp = get_array_module(target)
      if guesses.shape != target.shape:  # pragma: no cover
          err = f"Cannot calculate CategoricalCrossentropy loss: mismatched shapes: {guesses.shape} vs {target.shape}."
          raise ValueError(err)
      if xp.any(guesses > 1) or xp.any(guesses < 0):  # pragma: no cover
          err = f"Cannot calculate CategoricalCrossentropy loss with guesses outside the [0,1] interval."
          raise ValueError(err)
      if xp.any(target > 1) or xp.any(target < 0):  # pragma: no cover
          err = f"Cannot calculate CategoricalCrossentropy loss with truth values outside the [0,1] interval."
          raise ValueError(err)
      difference = guesses - target
      difference *= mask
      if self.normalize:
          difference = difference / guesses.shape[0]
      return difference
  
imports: from abc import abstractmethod
  from typing import Any, Dict, Generic, List, Optional, Sequence, Tuple, TypeVar, Union, cast
  from .config import registry
  from .types import Floats2d, Ints1d
  from .util import get_array_module, to_categorical
label_desc: Use image node_id 4 for calling the CategoricalCrossentropy obj's underlying member method code with example usage: obj.get_grad(guesses, truths) and returns: difference