code: def test_error_when_proposal_has_deficient_batch_shape(
      self, unknown_shape
  ):
      if unknown_shape and tf.executing_eagerly():
          self.skipTest("Eager execution.")
  
      as_tensor = tf.convert_to_tensor
      if unknown_shape:
          as_tensor = lambda x: tf1.placeholder_with_default(  # pylint: disable=g-long-lambda
              x, shape=[None for _ in tf.convert_to_tensor(x).shape]
          )
  
      resampled = importance_resample.ImportanceResample(
          proposal_distribution=normal.Normal(
              loc=as_tensor(0.0), scale=as_tensor(2.0)
          ),
          target_log_prob_fn=normal.Normal(
              loc=as_tensor([0.0, 0.0]), scale=as_tensor([1.0, 0.5])
          ).log_prob,
          importance_sample_size=2,
          validate_args=True,
      )
  
      with self.assertRaisesRegex(
          tf.errors.InvalidArgumentError
          if unknown_shape
          else ValueError,
          "Shape of importance weights does not match the batch",
      ):
          self.evaluate(resampled.sample(seed=test_util.test_seed()))
  
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 7 for calling the ImportanceResampleTest obj's underlying member method code with example usage: obj.test_error_when_proposal_has_deficient_batch_shape(unknown_shape) without return types