code: def testExcessiveConcretizationOfParams(self):
      loc = tfp_hps.defer_and_count_usage(
          tf.Variable(np.zeros((4, 2, 2)), shape=tf.TensorShape(None))
      )
      scale = tfp_hps.defer_and_count_usage(
          tf.Variable(np.ones([]), shape=tf.TensorShape(None))
      )
      ndims = tf.Variable(
          1, trainable=False, shape=tf.TensorShape(None)
      )
      dist = independent.Independent(
          logistic.Logistic(loc=loc, scale=scale, validate_args=True),
          reinterpreted_batch_ndims=ndims,
          validate_args=True,
      )
  
      # TODO(b/140579567): All methods of `dist` may require four concretizations
      # of parameters `loc` and `scale`:
      #  - `Independent._parameter_control_dependencies` calls
      #    `Logistic.batch_shape_tensor`, which:
      #    * Reads `loc`, `scale` in `Logistic._parameter_control_dependencies`.
      #    * Reads `loc`, `scale` in `Logistic._batch_shape_tensor`.
      #  - The method `dist.m` will call `dist.self.m`, which:
      #    * Reads `loc`, `scale` in `Logistic._parameter_control_dependencies`.
      #    * Reads `loc`, `scale` in the implementation of method  `Logistic._m`.
      #
      # NOTE: If `dist.distribution` had dynamic batch shape and event shape,
      # there could be two more reads of the parameters of `dist.distribution`
      # in `dist.event_shape_tensor`, from calling
      # `dist.distribution.event_shape_tensor()`.
  
      for method in (
          "batch_shape_tensor",
          "event_shape_tensor",
          "mode",
          "stddev",
          "entropy",
      ):
          with tfp_hps.assert_no_excessive_var_usage(
              method, max_permissible=4
          ):
              getattr(dist, method)()
  
      with tfp_hps.assert_no_excessive_var_usage(
          "sample", max_permissible=4
      ):
          dist.sample(seed=test_util.test_seed())
  
      for method in ("log_prob", "log_cdf", "prob", "cdf"):
          with tfp_hps.assert_no_excessive_var_usage(
              method, max_permissible=4
          ):
              getattr(dist, method)(np.zeros((3, 4, 2, 2)))
  
      # `Distribution.survival_function` and `Distribution.log_survival_function`
      # will call `Distribution.cdf` and `Distribution.log_cdf`, resulting in
      # one additional call to `Independent._parameter_control_dependencies`,
      # and thus two additional concretizations of the parameters.
  
      for method in ("survival_function", "log_survival_function"):
          with tfp_hps.assert_no_excessive_var_usage(
              method, max_permissible=6
          ):
              getattr(dist, method)(np.zeros((3, 4, 2, 2)))
  
imports: import functools
  import os
  from absl.testing import parameterized
  import numpy
  from scipy import stats
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import bernoulli
  from tensorflow_probability.python.distributions import exponential
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import log_prob_ratio
  from tensorflow_probability.python.distributions import logistic
  from tensorflow_probability.python.distributions import lognormal
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import poisson
  from tensorflow_probability.python.internal import hypothesis_testlib
  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 IndependentDistributionTest obj's underlying member method code with example usage: obj.testExcessiveConcretizationOfParams() without return types