code: def base_distributions(
      draw,
      dist_name=None,
      batch_shape=None,
      event_dim=None,
      enable_vars=False,
      eligibility_filter=lambda name: True,
      params=None,
      param_strategy_fn=None,
      validate_args=True,
  ):
      """Strategy for drawing arbitrary base Distributions.
  
      This does not draw compound distributions like `Independent`,
      `MixtureSameFamily`, or `TransformedDistribution`; only base Distributions
      that do not accept other Distributions as arguments.
  
      Args:
        draw: Hypothesis strategy sampler supplied by `@hps.composite`.
        dist_name: Optional Python `str`.  If given, the produced distributions
          will all have this type.
        batch_shape: An optional `TensorShape`.  The batch shape of the resulting
          Distribution.  Hypothesis will pick a batch shape if omitted.
        event_dim: Optional Python int giving the size of each of the
          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 at the top level.
        params: An optional set of Distribution parameters. If params are not
          provided, Hypothesis will choose a set of parameters.
        param_strategy_fn: Optional callable with signature
          `strategy = param_strategy_fn(shape, dtype, constraint_fn)`. If provided,
          overrides the default strategy for generating float-valued parameters.
          Default value: `None`.
        validate_args: Python `bool`; whether to enable runtime assertions.
  
      Returns:
        dists: A strategy for drawing Distributions with the specified `batch_shape`
          (or an arbitrary one if omitted).
      """
      if dist_name is None:
          names = [
              k
              for k in INSTANTIABLE_BASE_DISTS
              if eligibility_filter(k)
          ]
          dist_name = draw(hps.sampled_from(sorted(names)))
  
      if dist_name == "Empirical":
          variants = [
              k
              for k in INSTANTIABLE_BASE_DISTS
              if eligibility_filter(k) and "Empirical" in k
          ]
          dist_name = draw(hps.sampled_from(sorted(variants)))
  
      if dist_name == "SphericalUniform":
          return draw(
              spherical_uniforms(
                  batch_shape=batch_shape,
                  event_dim=event_dim,
                  validate_args=validate_args,
              )
          )
      elif dist_name == "IncrementLogProb":
          return draw(
              increment_log_probs(
                  batch_shape=batch_shape,
                  enable_vars=enable_vars,
                  validate_args=validate_args,
              )
          )
      elif dist_name == "ZeroInflatedNegativeBinomial":
          # We need a custom strategy for ZeroInflatedNegativeBinomial because
          # it currently isn't able to handle parameters with non-identical
          # batch dimensions.
          return draw(
              zero_inflated_negative_binomial(
                  batch_shape=batch_shape,
                  enable_vars=enable_vars,
                  validate_args=validate_args,
              )
          )
  
      if params is None:
          params_unconstrained, batch_shape = draw(
              base_distribution_unconstrained_params(
                  dist_name,
                  batch_shape=batch_shape,
                  event_dim=event_dim,
                  enable_vars=enable_vars,
                  param_strategy_fn=param_strategy_fn,
              )
          )
          params = constrain_params(params_unconstrained, dist_name)
      params = modify_params(
          params, dist_name, validate_args=validate_args
      )
      # Actually construct the distribution
      dist_cls = INSTANTIABLE_BASE_DISTS[dist_name].cls
      result_dist = dist_cls(**params)
  
      # Check that the batch shape came out as expected
      if batch_shape != result_dist.batch_shape:
          msg = (
              "Distributions strategy generated a bad batch shape "
              "for {}, should have been {}."
          ).format(result_dist, batch_shape)
          raise AssertionError(msg)
      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 21 for calling a global function with example usage: base_distributions(draw, dist_name, batch_shape, event_dim, enable_vars, eligibility_filter, params, param_strategy_fn, validate_args) and returns: result_dist, draw, draw, draw