code: def quantized_distributions(
      draw,
      batch_shape=None,
      event_dim=None,
      enable_vars=False,
      eligibility_filter=lambda name: True,
      validate_args=True,
  ):
      """Strategy for drawing `QuantizedDistribution`s.
  
      The underlying distribution is drawn from the `base_distributions` strategy.
  
      Args:
        draw: Hypothesis strategy sampler supplied by `@hps.composite`.
        batch_shape: An optional `TensorShape`.  The batch shape of the resulting
          `QuantizedDistribution`. Hypothesis will pick a `batch_shape` if omitted.
        event_dim: Optional Python int giving the size of each of the underlying
          distribution's parameters' event dimensions.  This is shared across all
          parameters, permitting square event matrices, compatible location and
          scale Tensors, etc. If omitted, Hypothesis will choose one.
        enable_vars: TODO(b/181859346): Make this `True` all the time and put
          variable initialization in slicing_test.  If `False`, the returned
          parameters are all `tf.Tensor`s and not {`tf.Variable`,
          `tfp.util.DeferredTensor` `tfp.util.TransformedVariable`}
        eligibility_filter: Optional Python callable.  Blocks some Distribution
          class names so they will not be drawn.
        validate_args: Python `bool`; whether to enable runtime assertions.
  
      Returns:
        dists: A strategy for drawing `QuantizedDistribution`s with the specified
          `batch_shape` (or an arbitrary one if omitted).
      """
  
      if batch_shape is None:
          batch_shape = draw(tfp_hps.shapes())
  
      low_quantile = draw(
          hps.one_of(
              hps.just(None), hps.floats(min_value=0.01, max_value=0.7)
          )
      )
      high_quantile = draw(
          hps.one_of(
              hps.just(None), hps.floats(min_value=0.3, max_value=0.99)
          )
      )
  
      def ok(name):
          return (
              eligibility_filter(name) and name in QUANTIZED_BASE_DISTS
          )
  
      underlyings = base_distributions(
          batch_shape=batch_shape,
          event_dim=event_dim,
          enable_vars=enable_vars,
          eligibility_filter=ok,
          validate_args=validate_args,
      )
      underlying = draw(underlyings)
  
      if high_quantile is not None:
          high_quantile = tf.convert_to_tensor(
              high_quantile, dtype=underlying.dtype
          )
      if low_quantile is not None:
          low_quantile = tf.convert_to_tensor(
              low_quantile, dtype=underlying.dtype
          )
          if high_quantile is not None:
              high_quantile = tfp_hps.ensure_high_gt_low(
                  low_quantile, high_quantile
              )
  
      hp.note(
          "Drawing QuantizedDistribution with underlying distribution"
          " {}".format(underlying)
      )
  
      try:
          low = (
              None
              if low_quantile is None
              else underlying.quantile(low_quantile)
          )
          high = (
              None
              if high_quantile is None
              else underlying.quantile(high_quantile)
          )
      except NotImplementedError:
          # The following code makes ReproducibilityTest flaky in graph mode (but not
          # eager). Failures are due either to partial mismatch in the samples in
          # ReproducibilityTest or to `low` and/or `high` being NaN. For now, to avoid
          # this, we set `low` and `high` to `None` for distributions not implementing
          # `quantile`.
  
          # seed = test_util.test_seed(hardcoded_seed=123)
          # low = (None if low_quantile is None
          #        else underlying.sample(low_quantile.shape, seed=seed))
          # high = (None if high_quantile is None else
          #         underlying.sample(high_quantile.shape, seed=seed))
          low = None
          high = None
  
      # Ensure that `low` and `high` are ints contained in distribution support
      # and span at least a few bins.
      if high is not None:
          high = tf.clip_by_value(high, -(2**23), 2**23)
          high = tf.math.ceil(high + 5.0)
  
      if low is not None:
          low = tf.clip_by_value(low, -(2**23), 2**23)
          low = tf.math.ceil(low)
  
      result_dist = tfd.QuantizedDistribution(
          distribution=underlying,
          low=low,
          high=high,
          validate_args=validate_args,
      )
  
      return result_dist
  
imports: import collections
  import functools
  import inspect
  from absl import logging
  import hypothesis
  from hypothesis import strategies
  import numpy
  import six
  import tensorflow.compat.v2
  from tensorflow_probability.python import distributions
  from tensorflow_probability.python import util
  from tensorflow_probability.python.bijectors import ascending
  from tensorflow_probability.python.bijectors import hypothesis_testlib
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.experimental import distributions
  from tensorflow_probability.python.internal import hypothesis_testlib
  from tensorflow_probability.python.internal import tensorshape_util
label_desc: Use image node_id 31 for calling a global function with example usage: quantized_distributions(draw, batch_shape, event_dim, enable_vars, eligibility_filter, validate_args) and returns: result_dist, unknown