code: def test_log1mexp():
      vals = np.array([-1, 0, 1e-20, 1e-4, 10, 100, 1e20])
      vals_ = vals.copy()
      # import mpmath
      # mpmath.mp.dps = 1000
      # [float(mpmath.log(1 - mpmath.exp(-x))) for x in vals]
      expected = np.array(
          [
              np.nan,
              -np.inf,
              -46.051701859880914,
              -9.210390371559516,
              -4.540096037048921e-05,
              -3.720075976020836e-44,
              0.0,
          ]
      )
      actual = pt.log1mexp(-vals).eval()
      npt.assert_allclose(actual, expected)
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              "divide by zero encountered in log",
              RuntimeWarning,
          )
          warnings.filterwarnings(
              "ignore",
              "invalid value encountered in log",
              RuntimeWarning,
          )
          actual_ = log1mexp_numpy(-vals, negative_input=True)
      npt.assert_allclose(actual_, expected)
      # Check that input was not changed in place
      npt.assert_allclose(vals, vals_)
  
imports: import warnings
  import numpy
  import numpy.testing
  import pytensor
  import pytensor.tensor
  import pytest
  from pymc.math import LogDet, cartesian, expand_packed_triangular, invprobit, kron_dot, kron_solve_lower, kronecker, log1mexp, log1mexp_numpy, logdet, logdiffexp, logdiffexp_numpy, probit
  from pymc.pytensorf import floatX
  from tests.helpers import verify_grad
label_desc: Use image node_id 7 for calling a global function with example usage: test_log1mexp() without return types