docstr: Instantiates a layer distribution and exercises its methods.
docstr_tok: ["Instantiates","a","layer","distribution","and","exercises","its","methods","."]
code: def testIsDistribution(self, dist_fn, has_conv=False):
      """Instantiates a layer distribution and exercises its methods."""
      dist = dist_fn(self.dtype)
      if has_conv and test_util.is_numpy_not_jax_mode():
          self.skipTest("tf.nn.conv not implemented in NumPy.")
      self.assertIsInstance(dist, distribution.Distribution)
      dtype = dist.dtype
      tf.nest.assert_same_structure(dtype, dist.batch_shape)
      tf.nest.assert_same_structure(dtype, dist.event_shape)
      tf.nest.assert_same_structure(dtype, dist.batch_shape_tensor())
      tf.nest.assert_same_structure(dtype, dist.event_shape_tensor())
      sample = dist.sample(
          [3], seed=test_util.test_seed(sampler_type="stateless")
      )
      tf.nest.assert_same_structure(dtype, sample)
  
      # Make sure we can use bijectors too.
      bijector = dist.experimental_default_event_space_bijector()
      unconstrained_sample = bijector.inverse(sample)
      unconstrained_sample = tf.nest.map_structure(
          lambda x: x + 0.0, unconstrained_sample
      )
      sample = bijector.forward(unconstrained_sample)
  
      lp = dist.log_prob(sample)
      expected_lp_shape = [3]
      self.assertEqual(expected_lp_shape, lp.shape)
  
imports: from absl.testing import parameterized
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import chain
  from tensorflow_probability.python.bijectors import real_nvp
  from tensorflow_probability.python.bijectors import scale
  from tensorflow_probability.python.bijectors import shift
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import joint_distribution_coroutine
  from tensorflow_probability.python.distributions import lognormal
  from tensorflow_probability.python.experimental.joint_distribution_layers import layers
  from tensorflow_probability.python.internal import custom_gradient
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 2 for calling the _JDLayersTestBase obj's underlying member method code with example usage: obj.testIsDistribution(dist_fn, has_conv) without return types