code: def _testSampleBatchMultivariate(self, fully_known_batch_shape):
      num_components = 3
      if fully_known_batch_shape:
          batch_shape = [2, 3]
          batch_shape_tensor = [2, 3]
      else:
          batch_shape = [None, 3]
          batch_shape_tensor = tf1.placeholder_with_default(
              [2, 3], shape=[2]
          )
  
      dist = make_multivariate_mixture(
          batch_shape=batch_shape,
          num_components=num_components,
          event_shape=[4],
          batch_shape_tensor=batch_shape_tensor,
      )
      n = 5
      seed = test_util.test_seed()
      with _test_capture_mvndiag_sample_outputs() as component_samples:
          with _test_capture_categorical_sample_outputs() as cat_samples:
              samples = dist.sample(n, seed=seed)
      self.assertLen(cat_samples, 1)
      cat_samples = cat_samples[0]
      self.assertEqual(samples.dtype, tf.float32)
      if fully_known_batch_shape:
          self.assertEqual((5, 2, 3, 4), samples.shape)
      else:
          self.assertEqual(
              [5, None, 3, 4], tensorshape_util.as_list(samples.shape)
          )
      (
          sample_values,
          cat_sample_values,
          dist_sample_values,
      ) = self.evaluate([samples, cat_samples, component_samples])
      self.assertEqual((5, 2, 3, 4), sample_values.shape)
  
      for c in range(num_components):
          which_c_s, which_c_b0, which_c_b1 = np.where(
              cat_sample_values == c
          )
          # Batch univariate case: batch_size == [2, 3], rank 4 (multivariate)
          which_dist_samples = dist_sample_values[c][
              which_c_s, which_c_b0, which_c_b1, :
          ]
          self.assertAllClose(
              which_dist_samples,
              sample_values[which_c_s, which_c_b0, which_c_b1, :],
          )
  
imports: import contextlib
  import warnings
  import numpy
  from scipy import stats
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import categorical
  from tensorflow_probability.python.distributions import dirichlet
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import gamma
  from tensorflow_probability.python.distributions import half_normal
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import mixture
  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.internal import hypothesis_testlib
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
label_desc: Use image node_id 19 for calling the MixtureTest obj's underlying member method code with example usage: obj._testSampleBatchMultivariate(fully_known_batch_shape) without return types