code: def log_average_probs(
      logits,
      sample_axis=0,
      event_axis=None,
      keepdims=False,
      validate_args=False,
      name=None,
  ):
      """Computes `log(average(to_probs(logits)))` in a numerically stable manner.
  
      The meaning of `to_probs` is controlled by the `event_axis` argument. When
      `event_axis` is `None`, `to_probs = tf.math.sigmoid` and otherwise
      `to_probs = lambda x: tf.math.log_softmax(x, axis=event_axis)`.
  
      `sample_axis` and `event_axis` should have a null intersection. This
      requirement is always verified when `validate_args` is `True`.
  
      Args:
        logits: A `float` `Tensor` representing logits.
        sample_axis: Scalar or vector `Tensor` designating axis holding samples, or
          `None` (meaning all axis hold samples).
          Default value: `0` (leftmost dimension).
        event_axis: Scalar or vector `Tensor` designating the axis representing
          categorical logits.
          Default value: `None` (i.e., Bernoulli logits).
        keepdims:  Boolean.  Whether to keep the sample axis as singletons.
          Default value: `False` (i.e., squeeze the reduced dimensions).
        validate_args: Python `bool`, default `False`. When `True` distribution
          parameters are checked for validity despite possibly degrading runtime
          performance. When `False` invalid inputs may silently render incorrect
          outputs.
          Default value: `False` (i.e., do not validate args).
        name: Python `str` name prefixed to Ops created by this function.
          Default value: `None` (i.e., `'log_average_probs'`).
  
      Returns:
        log_avg_probs: The natural log of the average of probs computed from logits.
      """
      with tf.name_scope(name or "average_sigmoid"):
          logits = tf.convert_to_tensor(
              logits, dtype_hint=tf.float32, name="logits"
          )
          if sample_axis is not None:
              sample_axis = ps.convert_to_shape_tensor(
                  sample_axis, dtype_hint=tf.int32, name="sample_axis"
              )
          if event_axis is not None:
              event_axis = ps.convert_to_shape_tensor(
                  event_axis, dtype_hint=tf.int32, name="event_axis"
              )
          if event_axis is None:
              # log(sigmoid(x)) = log(1 / (1 + exp(-x))) = -log1p(exp(-x)) = -sp(-x)
              log_probs = -tf.math.softplus(-logits)
          else:
              sample_axis, event_axis = _log_average_probs_process_args(
                  logits, validate_args, sample_axis, event_axis
              )
              with tf.control_dependencies(
                  _log_average_probs_maybe_check_args(
                      sample_axis, event_axis, validate_args
                  )
              ):
                  log_probs = _log_softmax(logits, axis=event_axis)
          return reduce_logmeanexp(
              log_probs, axis=sample_axis, keepdims=keepdims
          )
  
imports: import numpy
  import tensorflow.compat.v2
  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 prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.math.generic import reduce_logmeanexp
label_desc: Use image node_id 12 for calling a global function with example usage: log_average_probs(logits, sample_axis, event_axis, keepdims, validate_args, name) and returns: reduce_logmeanexp