code: def entropy(a: np.array, x: np.array, **kwargs) -> float:
      """
      Calculate entropy of a single array.
  
      Parameters
      ----------
      a: np.ndarray
          Array to calculate entropy on. One sample at a time.
      x: np.ndarray
          Array to compute shape.
      kwargs: optional
              Keyword arguments.
  
      Returns
      -------
      float:
          A floating point, raning [0, inf].
      """
      assert (
          a >= 0
      ).all(), "Entropy computation requires non-negative values."
  
      if len(x.shape) == 1:
          newshape = np.prod(x.shape)
      else:
          newshape = np.prod(x.shape[1:])
  
      a_reshaped = np.reshape(a, int(newshape))
      a_normalised = a_reshaped.astype(np.float64) / np.sum(
          np.abs(a_reshaped)
      )
      return scipy.stats.entropy(pk=a_normalised)
  
imports: import scipy
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: entropy(a, x) and returns: scipy