code: def testExcessiveConcretizationOfParams(self):
      logits = tfp_hps.defer_and_count_usage(
          # Dynamic rank would incur extra concretizations because batch
          # broadcasting can't be short-circuited.
          self._build_variable(
              np.zeros((5)), static_rank=True, name="logits"
          )
      )
      concentration = tfp_hps.defer_and_count_usage(
          self._build_variable(
              np.zeros((5, 3)), static_rank=True, name="concentration"
          )
      )
      dist = mixture_same_family.MixtureSameFamily(
          mixture_distribution=categorical.Categorical(logits=logits),
          components_distribution=dirichlet.Dirichlet(
              concentration=concentration
          ),
          validate_args=True,
      )
  
      # Many methods use mixture_distribution and components_distribution at most
      # once, and thus incur no extra reads/concretizations of parameters.
  
      for method in (
          "batch_shape_tensor",
          "event_shape_tensor",
          "mean",
      ):
          with tfp_hps.assert_no_excessive_var_usage(
              method, max_permissible=2
          ):
              getattr(dist, method)()
  
      with tfp_hps.assert_no_excessive_var_usage(
          "sample", max_permissible=2
      ):
          dist.sample(seed=test_util.test_seed())
  
      for method in ("log_prob", "prob"):
          with tfp_hps.assert_no_excessive_var_usage(
              method, max_permissible=2
          ):
              getattr(dist, method)(np.ones((4, 4, 3)) / 3.0)
  
      # TODO(b/140579567): The `variance()` and `covariance()` methods require
      # calling both:
      #  - `self.components_distribution.mean()`
      #  - `self.components_distribution.variance()` or `.covariance()`
      # Thus, these methods incur an additional concretization (or two if
      # `validate_args=True` for `self.components_distribution`).
  
      for method in ("variance", "covariance"):
          with tfp_hps.assert_no_excessive_var_usage(
              method, max_permissible=3
          ):
              getattr(dist, method)()
  
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 24 for calling the _MixtureSameFamilyTest obj's underlying member method code with example usage: obj.testExcessiveConcretizationOfParams() without return types