code: def logit_normal_trapezoid_rule(loc, scale):
      """Brute-force statistics of LogitNormal(loc, scale) by quadrature."""
      # LogitNormal samples as
      #   z ~ Normal(loc, scale)
      #   return sigmoid(z)
      # We find the statistics by integrating f(z) * Normal.pdf(z) over z.
      # The function f is always bounded, and for z outside +-10 * scale,
      # the Normal cdf is small enough to be negligible.  Thus it suffices
      # to integrate from loc - 10 * scale to loc + 10 * scale
      n = 10000
      width = 10.0
      xs = tf.linspace(loc - width * scale, loc + width * scale, n)
  
      def trapezoid(vals):
          total = tf.reduce_sum(vals, axis=0) - 0.5 * (
              vals[0] + vals[-1]
          )
          return total * 2 * width * scale / tf.cast((n - 1), xs.dtype)
  
      return xs, trapezoid
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import bernoulli
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import logitnormal
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 1 for calling a global function with example usage: logit_normal_trapezoid_rule(loc, scale) and returns: xs,  trapezoid, unknown