code: def test_supports_joint_events(self):
      root = jdc.JointDistributionCoroutine.Root
  
      @jdc.JointDistributionCoroutine
      def target():
          x = yield root(normal.Normal(-1.0, 1.0, name="x"))
          yield mvn_tril.MultivariateNormalTriL(
              loc=(x + 2)[..., tf.newaxis], scale_tril=[[0.5]], name="y"
          )
  
      @jdc.JointDistributionCoroutine
      def proposal():
          yield root(
              student_t.StudentT(df=2, loc=0.0, scale=2.0, name="x")
          )
          yield root(
              independent.Independent(
                  student_t.StudentT(df=2, loc=[0.0], scale=[2.0]),
                  1,
                  name="y",
              )
          )
  
      resampled = importance_resample.ImportanceResample(
          proposal,
          target_log_prob_fn=target.log_prob,
          importance_sample_size=5,
      )
      self.assertAllEqual(resampled.dtype, proposal.dtype)
      self.assertAllEqualNested(
          list(resampled.event_shape), list(proposal.event_shape)
      )
  
      seed = test_util.test_seed(sampler_type="stateless")
      x = self.evaluate(resampled.sample(2, seed=seed))
      self.evaluate(resampled.log_prob(x, sample_size=10, seed=seed))
  
      # Expectation of a structured statistic.
      estimated_mean = resampled.self_normalized_expectation(
          lambda x: x, sample_size=10000, seed=seed
      )
      self.assertAllClose(estimated_mean.x, -1.0, atol=0.2)
      self.assertAllClose(estimated_mean.y, [1.0], atol=0.22)
  
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import categorical
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import joint_distribution_coroutine
  from tensorflow_probability.python.distributions import mixture_same_family
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import mvn_tril
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import student_t
  from tensorflow_probability.python.experimental.distributions import importance_resample
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.vi import csiszar_divergence
label_desc: Use image node_id 6 for calling the ImportanceResampleTest obj's underlying member method code with example usage: obj.test_supports_joint_events() without return types