code: def tests_aligns_broadcast_dims_using_core_ndims(self, is_static):
      np.random.seed(test_util.test_seed() % 2**32)
  
      def matvec(a, b):
          # Throws an error if either arg has extra dimensions.
          return tf.linalg.matvec(
              tf.reshape(a, tf.shape(a)[-2:]),
              tf.reshape(b, tf.shape(b)[-1:]),
          )
  
      vectorized_matvec = vectorization_util.make_rank_polymorphic(
          matvec,
          core_ndims=(
              self.maybe_static(2, is_static=is_static),
              self.maybe_static(1, is_static=is_static),
          ),
      )
  
      for a_shape, b_shape in (
          ([3, 2], [2]),
          ([4, 3, 2], [2]),
          ([4, 3, 2], [5, 1, 2]),
      ):
          a = self.maybe_static(
              np.random.randn(*a_shape), is_static=is_static
          )
          b = self.maybe_static(
              np.random.randn(*b_shape), is_static=is_static
          )
  
          c = tf.linalg.matvec(a, b)
          c_vectorized = vectorized_matvec(a, b)
          if is_static:
              self.assertAllEqual(c.shape, c_vectorized.shape)
          self.assertAllEqual(*self.evaluate((c, c_vectorized)))
  
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 5 for calling the VectorizationTest obj's underlying member method code with example usage: obj.tests_aligns_broadcast_dims_using_core_ndims(is_static) and returns: tf