code: def _btrs(counts, probs, full_shape, seed):
      """Binomial transformed rejection sampler, for count*prob >= 10."""
      # We use a transformation-rejection algorithm from
      # pairs of uniform random variables due to Hormann.
      # https://www.tandfonline.com/doi/abs/10.1080/00949659308811496
  
      seed = samplers.sanitize_seed(seed)
      # This is spq in the paper.
      stddev = tf.math.sqrt(counts * probs * (1 - probs))
  
      # Other coefficients for Transformed Rejection sampling.
      b = 1.15 + 2.53 * stddev
      a = -0.0873 + 0.0248 * b + 0.01 * probs
      c = counts * probs + 0.5
      r = probs / (1 - probs)
  
      alpha = (2.83 + 5.1 / b) * stddev
      m = tf.math.floor((counts + 1) * probs)
  
      def batched_las_vegas_trial_fn(seed):
          u_seed, v_seed = samplers.split_seed(seed)
          u = (
              samplers.uniform(
                  full_shape, seed=u_seed, dtype=counts.dtype
              )
              - 0.5
          )
          v = samplers.uniform(
              full_shape, seed=v_seed, dtype=counts.dtype
          )
          us = 0.5 - tf.math.abs(u)
          k = tf.math.floor((2 * a / us + b) * u + c)
  
          # When the bounding box is tight, this criteria is more numerically stable
          # and equally valid. Particularly on GPU/TPU, it may make the difference
          # between terminating and non-terminating loops.
          v_r = 0.92 - 4.2 / b
          accept_boxed = (us >= 0.07) & (v <= v_r)
  
          # Reject non-sensical answers.
          reject = (k < 0) | (k > counts)
  
          # This deviates from Hormann's BTRS algorithm, as there is a log missing.
          # For all (u, v) pairs outside of the bounding box, this calculates the
          # transformed-reject ratio.
          v = tf.math.log(v * alpha / (a / (us * us) + b))
          upperbound = (
              (m + 0.5) * tf.math.log((m + 1) / (r * (counts - m + 1)))
              + (counts + 1)
              * tf.math.log((counts - m + 1) / (counts - k + 1))
              + (k + 0.5) * tf.math.log(r * (counts - k + 1) / (k + 1))
              + _stirling_approx_tail(m)
              + _stirling_approx_tail(counts - m)
              - _stirling_approx_tail(k)
              - _stirling_approx_tail(counts - k)
          )
          accept_bounded = v <= upperbound
          return k, (~reject) & (accept_boxed | accept_bounded)
  
      return batched_rejection_sampler.batched_las_vegas_algorithm(
          batched_las_vegas_trial_fn, seed=seed
      )[0]
  
imports: 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 batched_rejection_sampler
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import implementation_selection
  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.internal import tensorshape_util
  from tensorflow_probability.python.math import special
label_desc: Use image node_id 5 for calling a global function with example usage: _btrs(counts, probs, full_shape, seed) and returns: batched_rejection_sampler, k,  unknown