code: def gradient(self):
          
          functional = self
  
          class KLCrossEntCCGradient(Operator):
  
              """The gradient operator of this functional."""
  
              def __init__(self):
                  """Initialize a new instance."""
                  super(KLCrossEntCCGradient, self).__init__(
                      functional.domain, functional.domain, linear=False)
  
              def _call(self, x):
                  """Apply the gradient operator to the given point."""
                  if functional.prior is None:
                      return self.domain.element(np.exp(x))
                  else:
                      return functional.prior * np.exp(x)
  
          return KLCrossEntCCGradient()
docs: Gradient operator of the functional.