code: def test_tril(self):
      cov = 0.9 * tf.ones([3, 3]) + 0.1 * tf.eye(3)
      s = tf.linalg.cholesky(cov)
      mv_tril = mvn_tril.MultivariateNormalTriL(
          loc=[1.0, 2.0, 3.0], scale_tril=s
      )
  
      if self.use_default_momentum_distribution:
          momentum_distribution = None
      else:
          momentum_distribution = mvnpflo.MultivariateNormalPrecisionFactorLinearOperator(
              # TODO(b/170015229) Don't use the covariance as inverse scale,
              # it is the wrong preconditioner.
              precision_factor=tf.linalg.LinearOperatorFullMatrix(cov),
          )
      hmc_kernel = phmc.PreconditionedHamiltonianMonteCarlo(
          target_log_prob_fn=mv_tril.log_prob,
          momentum_distribution=momentum_distribution,
          step_size=0.2,
          num_leapfrog_steps=10,
      )
      draws = sample.sample_chain(
          120,
          tf.zeros(3),
          kernel=hmc_kernel,
          seed=test_util.test_seed(),
          trace_fn=None,
      )
      ess = diagnostic.effective_sample_size(
          draws[-100:],
          filter_threshold=0,
          filter_beyond_positive_pairs=False,
      )
  
      # TODO(b/170015229): These and other tests like it, which assert ess is
      # greater than some number, were all passing, even though the preconditioner
      # was the wrong one. Why is that? A guess is that since there are *many*
      # ways to have larger ess, these tests don't really test correctness.
      # Perhaps remove all tests like these.
      if not self.use_default_momentum_distribution:
          self.assertAllClose(ess, tf.fill([3], 100.0))
      else:
          self.assertLess(self.evaluate(tf.reduce_min(ess)), 100.0)
  
imports: import collections
  from absl.testing import parameterized
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import reshape
  from tensorflow_probability.python.bijectors import scale
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import joint_distribution_sequential
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import mvn_linear_operator
  from tensorflow_probability.python.distributions import mvn_tril
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import wishart
  from tensorflow_probability.python.experimental.distributions import mvn_precision_factor_linop
  from tensorflow_probability.python.experimental.mcmc import preconditioned_hmc
  from tensorflow_probability.python.internal import auto_composite_tensor
  from tensorflow_probability.python.internal import distribute_lib
  from tensorflow_probability.python.internal import distribute_test_lib
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.internal import unnest
  from tensorflow_probability.python.mcmc import diagnostic
  from tensorflow_probability.python.mcmc import dual_averaging_step_size_adaptation
  from tensorflow_probability.python.mcmc import sample
  from tensorflow_probability.python.mcmc import simple_step_size_adaptation
  from tensorflow_probability.python.mcmc import transformed_kernel
  from tensorflow_probability.python.mcmc.internal import leapfrog_integrator
  from tensorflow_probability.python.stats import sample_stats
label_desc: Use image node_id 5 for calling the _PreconditionedHMCTest obj's underlying member method code with example usage: obj.test_tril() without return types