code: def test_default_event_space_bijector(self, jd_class):
      models = {}
  
      def coroutine_model():
          high = yield lognormal.LogNormal(0.0, [1.0])
          yield uniform.Uniform(
              low=[[-1.0, -2.0]], high=high[..., tf.newaxis]
          )
          yield deterministic.Deterministic([[0.0, 1.0, 2.0]])
  
      models[
          jdab.JointDistributionCoroutineAutoBatched
      ] = coroutine_model
  
      models[jdab.JointDistributionSequentialAutoBatched] = [
          lognormal.LogNormal(0.0, [1.0]),
          lambda high: uniform.Uniform(  # pylint: disable=g-long-lambda
              low=[[-1.0, -2.0]], high=high[..., tf.newaxis]
          ),
          deterministic.Deterministic([[0.0, 1.0, 2.0]]),
      ]
  
      models[
          jdab.JointDistributionNamedAutoBatched
      ] = collections.OrderedDict(
          (
              ("high", lognormal.LogNormal(0.0, [1.0])),
              (
                  "x",
                  lambda high: uniform.Uniform(  # pylint: disable=g-long-lambda
                      low=[[-1.0, -2.0]], high=high[..., tf.newaxis]
                  ),
              ),
              ("y", deterministic.Deterministic([[0.0, 1.0, 2.0]])),
          )
      )
  
      joint = jd_class(
          models[jd_class], batch_ndims=1, validate_args=True
      )
      self.assertAllEqual(joint.batch_shape, [1])
      self.assertAllEqualNested(
          tf.nest.flatten(joint.event_shape), [[], [2], [3]]
      )
      joint_bijector = joint.experimental_default_event_space_bijector()
  
      y = self.evaluate(
          joint.sample([2, 3], seed=test_util.test_seed())
      )
      x = joint_bijector.inverse(y)
      self.assertAllCloseNested(y, joint_bijector.forward(x))
  
      fldj = joint_bijector.forward_log_det_jacobian(
          x,
          event_ndims=tf.nest.pack_sequence_as(joint.dtype, [0, 1, 2]),
      )
      ildj = joint_bijector.inverse_log_det_jacobian(
          y,
          event_ndims=tf.nest.pack_sequence_as(joint.dtype, [0, 1, 1]),
      )
      self.assertAllEqual(fldj.shape, joint.log_prob(y).shape)
      self.assertAllClose(fldj, -ildj)
  
      # Passing inputs *without* batch shape should return sane outputs.
      y = self.evaluate(joint.sample([], seed=test_util.test_seed()))
      # Strip the sample to represent just a single event.
      unbatched_y = tf.nest.map_structure(lambda t: t[0, ...], y)
      self.assertAllEqualNested(
          tf.nest.map_structure(tf.shape, unbatched_y),
          joint.event_shape_tensor(),
      )
      ildj = joint_bijector.inverse_log_det_jacobian(
          unbatched_y,
          event_ndims=tf.nest.pack_sequence_as(joint.dtype, [0, 1, 1]),
      )
      self.assertAllEqual(ildj.shape, joint.log_prob(unbatched_y).shape)
  
imports: import collections
  import os
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector_test_util
  from tensorflow_probability.python.bijectors import exp
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.distributions import bernoulli
  from tensorflow_probability.python.distributions import deterministic
  from tensorflow_probability.python.distributions import dirichlet
  from tensorflow_probability.python.distributions import exponential
  from tensorflow_probability.python.distributions import half_normal
  from tensorflow_probability.python.distributions import inverse_gamma
  from tensorflow_probability.python.distributions import joint_distribution_auto_batched
  from tensorflow_probability.python.distributions import joint_distribution_coroutine
  from tensorflow_probability.python.distributions import joint_distribution_named
  from tensorflow_probability.python.distributions import joint_distribution_sequential
  from tensorflow_probability.python.distributions import lognormal
  from tensorflow_probability.python.distributions import multinomial
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import poisson
  from tensorflow_probability.python.distributions import sample
  from tensorflow_probability.python.distributions import student_t
  from tensorflow_probability.python.distributions import transformed_distribution
  from tensorflow_probability.python.distributions import uniform
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.util import deferred_tensor
label_desc: Use image node_id 19 for calling the JointDistributionAutoBatchedTest obj's underlying member method code with example usage: obj.test_default_event_space_bijector(jd_class) without return types