code: def log_normalize(a, axis=None):
      """
      Normalize the input array so that ``sum(exp(a)) == 1``.
  
      Parameters
      ----------
      a : array
          Non-normalized input data.
  
      axis : int
          Dimension along which normalization is performed.
  
      Notes
      -----
      Modifies the input **inplace**.
      """
      if axis is not None and a.shape[axis] == 1:
          # Handle single-state GMMHMM in the degenerate case normalizing a
          # single -inf to zero.
          a[:] = 0
      else:
          with np.errstate(under="ignore"):
              a_lse = special.logsumexp(a, axis, keepdims=True)
          a -= a_lse
  
imports: import numpy
  from scipy import special
label_desc: Use image node_id 2 for calling a global function with example usage: log_normalize(a, axis) without return types