code: def log1mexp(x, name=None):
      """Compute `log(1 - exp(-|x|))` elementwise in a numerically stable way.
  
      Args:
        x: Float `Tensor`.
        name: Python `str` name prefixed to Ops created by this function.
          Default value: `None` (i.e., `'log1mexp'`).
  
      Returns:
        log1mexp: Float `Tensor` of `log1mexp(x)`.
  
      #### References
  
      [1]: Machler, Martin. Accurately computing log(1 - exp(-|a|))
           https://cran.r-project.org/web/packages/Rmpfr/vignettes/log1mexp-note.pdf
      """
  
      with tf.name_scope(name or "log1mexp"):
          dtype = dtype_util.common_dtype([x], dtype_hint=tf.float32)
          x = tf.convert_to_tensor(x, dtype=dtype, name="x")
          x = tf.math.abs(x)
          return tf.where(
              # This switching point is recommended in [1].
              x < np.log(2),
              tf.math.log(-tf.math.expm1(-x)),
              tf.math.log1p(-tf.math.exp(-x)),
          )
  
imports: import collections
  import functools
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import custom_gradient
  from tensorflow_probability.python.internal import distribute_lib
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import variadic_reduce
  from tensorflow_probability.python.math.scan_associative import scan_associative
  from tensorflow.python.util import deprecation
label_desc: Use image node_id 15 for calling a global function with example usage: log1mexp(x, name) and returns: tf