code: def _check_pinning(self, pinned, sample_shape):
      self.evaluate(
          tf.nest.map_structure(
              tf.convert_to_tensor, pinned.event_shape_tensor()
          )
      )
  
      s0 = pinned.sample_unpinned(
          sample_shape,
          seed=test_util.test_seed(sampler_type="stateless"),
      )
      w0 = self.evaluate(pinned.log_weight(s0))
  
      s0dict = (
          s0
          if isinstance(s0, dict)
          else dict(zip(pinned._flat_resolve_names(), s0))
      )
      self.assertAllClose(
          pinned.distribution.log_prob(**dict(pinned.pins, **s0dict)),
          pinned.unnormalized_log_prob(s0),
      )
  
      self.assertAllClose(
          sum(
              tf.nest.flatten(
                  pinned.unnormalized_log_prob_parts(s0).pinned
              )
          ),
          w0,
      )
  
      s1, w1 = pinned.sample_and_log_weight(
          sample_shape,
          seed=test_util.test_seed(sampler_type="stateless"),
      )
      self.assertAllClose(
          w1
          + sum(
              tf.nest.flatten(
                  pinned.unnormalized_log_prob_parts(s1).unpinned
              )
          ),
          pinned.unnormalized_log_prob(s1),
      )
  
      bij = pinned.experimental_default_event_space_bijector()
      pullback_event_shp = bij.inverse_event_shape(pinned.event_shape)
      self.assertAllEqualNested(
          pinned.event_shape,
          bij.forward_event_shape(pullback_event_shp),
      )
  
      pullback_s0 = tf.nest.map_structure(tf.identity, bij.inverse(s0))
      self.assertAllCloseNested(s0, bij.forward(pullback_s0))
  
      init = tf.nest.map_structure(
          lambda s: tf.random.uniform(
              s, -2.0, 2.0, seed=test_util.test_seed()
          ),
          pullback_event_shp,
      )
      self.evaluate(pinned.unnormalized_log_prob(bij.forward(init)))
      self.evaluate(
          pinned.unnormalized_log_prob_parts(bij.forward(init))
      )
  
imports: import collections
  import functools
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import pad
  from tensorflow_probability.python.distributions import beta
  from tensorflow_probability.python.distributions import binomial
  from tensorflow_probability.python.distributions import cholesky_lkj
  from tensorflow_probability.python.distributions import gamma
  from tensorflow_probability.python.distributions import independent
  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 multinomial
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import sample
  from tensorflow_probability.python.distributions import uniform
  from tensorflow_probability.python.experimental.distributions import increment_log_prob
  from tensorflow_probability.python.experimental.distributions import joint_distribution_pinned
  from tensorflow_probability.python.internal import structural_tuple
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import generic
label_desc: Use image node_id 3 for calling the JointDistributionPinnedParameterizedTest obj's underlying member method code with example usage: obj._check_pinning(pinned, sample_shape) without return types