code: def _probs_and_log_probs(
      probs=None, logits=None, return_probs=True, return_log_probs=True
  ):
      """Get parts/all of (1 - p, p, Log[1 - p], Log[p]);  only one conversion."""
      to_return = ()
  
      # All use cases provide exactly one of probs or logits.  If we were to choose,
      # we prefer logits.  Why?  Because, for p very close to 1,
      # 1 - p will equal 0 (in finite precision), whereas sigmoid(-logits) will give
      # the correct (tiny) value.
      assert (probs is None) != (logits is None), "Provide exactly one."
  
      if logits is None:
          p = tf.convert_to_tensor(probs)
          if return_probs:
              to_return += (1 - p, p)
          if return_log_probs:
              to_return += (tf.math.log1p(-p), tf.math.log(p))
          return to_return
  
      s = tf.convert_to_tensor(logits)
      if return_probs:
          to_return += (tf.math.sigmoid(-s), tf.math.sigmoid(s))
      if return_log_probs:
          to_return += (-tf.math.softplus(s), -tf.math.softplus(-s))
      return to_return
  
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import sigmoid
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensor_util
label_desc: Use image node_id 2 for calling a global function with example usage: _probs_and_log_probs(probs, logits, return_probs, return_log_probs) and returns: to_return, to_return