code: def test_unit_batch_dims_are_flattened(self):
      # Define `fn` to expect a vector input.
      fn = lambda x: tf.einsum("n->", x)
      # Verify that it won't accept a batch dimension.
      with self.assertRaisesRegexp(Exception, "rank"):
          fn(tf.zeros([1, 5]))
  
      polymorphic_fn = vectorization_util.make_rank_polymorphic(
          fn, core_ndims=[1]
      )
      for batch_shape in ([], [1], [1, 1]):
          self.assertEqual(
              batch_shape,
              polymorphic_fn(tf.zeros(batch_shape + [5])).shape,
          )
  
imports: import warnings
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import lognormal
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import poisson
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.internal import vectorization_util
label_desc: Use image node_id 9 for calling the VectorizationTest obj's underlying member method code with example usage: obj.test_unit_batch_dims_are_flattened() without return types