code: def _sample_bates(total_count, low, high, n, seed=None):
      """Vectorized production of `Bates` samples.
  
      Args:
        total_count: (Batches of) counts of `Uniform`s to take means of.  Should
          have integer dtype and already be broadcasted to the batch shape.
        low: (Batches of) lower bounds of the `Uniform` variables to sample.  Should
          be the same floating dtype as `high` and broadcastable to the batch shape.
        high: (Batches of) upper bounds of the `Uniform` variables to sample. Should
          be the same floating dtype as `low` and broadcastable to the batch shape.
        n: `int32` number of samples to generate.
        seed: PRNG seed; see `tfp.random.sanitize_seed` for details.
  
      Returns:
        samples: Samples of (batches of) the `Bates` variable.  Will have same dtype
          as `low` and `high`. If the batch shape is `[B1,..., Bn]`, `samples` has
          shape `[n, B1,..., Bn]`.
      """
  
      # 1. Sample Uniform(0, 1)s, flattening the batch dimension into axis 0.
      uniform_sample_shape = ps.concat(
          [[ps.reduce_sum(total_count)], [n]], axis=0
      )
      uniform_samples = samplers.uniform(
          uniform_sample_shape,
          minval=0.0,
          maxval=1.0,
          dtype=low.dtype,
          seed=seed,
      )
      # 2. Produce segment means.
      segment_lengths = tf.reshape(total_count, [-1])
      segment_ids = tf.repeat(
          tf.range(tf.size(segment_lengths)), segment_lengths
      )
      flatmeans = tf.math.segment_mean(uniform_samples, segment_ids)
      # 3. Reshape and transpose segment means back to the original shape.
      outshape = tf.concat([tf.shape(total_count), [n]], axis=0)
      tmeans = tf.reshape(flatmeans, outshape)
      axes = tf.range(tf.rank(tmeans))
      means = tf.transpose(tmeans, tf.roll(axes, shift=1, axis=0))
      # 4. Shift/scale from (0, 1) to (low, high).
      return low + (high - low) * means
  
imports: import sys
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import sigmoid
  from tensorflow_probability.python.distributions import distribution
  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
  from tensorflow_probability.python.math import special
label_desc: Use image node_id 5 for calling a global function with example usage: _sample_bates(total_count, low, high, n, seed) and returns: unknown