code: def testBatchShapesAreBroadcast(self):
      logits_seed, loc_seed, seed = samplers.split_seed(
          test_util.test_seed(sampler_type="stateless"), n=3
      )
      logits = self.evaluate(
          samplers.normal([3, 1, 5], seed=logits_seed)
      )
      loc = self.evaluate(samplers.normal([1, 4, 5, 2], seed=loc_seed))
      dist = mixture_same_family.MixtureSameFamily(
          mixture_distribution=categorical.Categorical(
              logits=self._build_tensor(logits)
          ),
          components_distribution=independent.Independent(
              logistic.Logistic(loc=self._build_tensor(loc), scale=1.0),
              reinterpreted_batch_ndims=1,
          ),
          validate_args=True,
      )
      self.assertAllEqual(dist.batch_shape_tensor(), [3, 4])
      mean, variance = self.evaluate((dist.mean(), dist.variance()))
      self.assertAllEqual(mean.shape, [3, 4, 2])
      self.assertAllEqual(variance.shape, [3, 4, 2])
  
      x, x_lp = self.evaluate(
          dist.experimental_sample_and_log_prob([2, 1], seed=seed)
      )
      self.assertAllEqual(x.shape, [2, 1, 3, 4, 2])
  
      mode = self.evaluate(dist.posterior_mode(x))
      self.assertAllEqual(mode.shape, [2, 1, 3, 4])
      marginals_logits = self.evaluate(
          dist.posterior_marginal(x).logits_parameter()
      )
      self.assertAllEqual(marginals_logits.shape, [2, 1, 3, 4, 5])
  
      fully_broadcast_dist = mixture_same_family.MixtureSameFamily(
          mixture_distribution=(
              dist.mixture_distribution._broadcast_parameters_with_batch_shape(
                  [3, 4]
              )
          ),
          components_distribution=(
              dist.components_distribution._broadcast_parameters_with_batch_shape(
                  [3, 4, 5]
              )
          ),
          validate_args=True,
      )
      self.assertAllEqual(
          fully_broadcast_dist.mixture_distribution.batch_shape_tensor(),
          [3, 4],
      )
      self.assertAllEqual(
          fully_broadcast_dist.components_distribution.batch_shape_tensor(),
          [3, 4, 5],
      )
  
      x2 = self.evaluate(fully_broadcast_dist.sample([2, 1], seed=seed))
      self.assertAllEqual(x, x2)
      self.assertAllClose(x_lp, fully_broadcast_dist.log_prob(x))
  
imports: import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import bernoulli
  from tensorflow_probability.python.distributions import categorical
  from tensorflow_probability.python.distributions import dirichlet
  from tensorflow_probability.python.distributions import exponential
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import logistic
  from tensorflow_probability.python.distributions import mixture_same_family
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import hypothesis_testlib
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 12 for calling the _MixtureSameFamilyTest obj's underlying member method code with example usage: obj.testBatchShapesAreBroadcast() without return types