code: def _log_sub(logx: float, logy: float) -> float:
      """Subtract two numbers in the log space. Answer must be non-negative."""
      if logx < logy:
          raise ValueError(
              "The result of subtraction must be non-negative."
          )
      if logy == -np.inf:  # subtracting 0
          return logx
      if logx == logy:
          return (
              -np.inf
          )  # 0 is represented as -np.inf in the log space.
  
      try:
          # Use exp(x) - exp(y) = (exp(x - y) - 1) * exp(y).
          return (
              math.log(math.expm1(logx - logy)) + logy
          )  # expm1(x) = exp(x) - 1
      except OverflowError:
          return logx
  
imports: import math
  from typing import Tuple, Union
  import numpy
  from scipy import special
  import six
label_desc: Use image node_id 2 for calling a global function with example usage: _log_sub(logx, logy) and returns: logx, unknown, unknown, logx