code: def testCompositeTensorOrPytree(self):
      amplitude = np.array([1.0, 2.0], np.float64).reshape([2, 1])
      length_scale = np.array([0.1, 0.2, 0.3], np.float64).reshape(
          [1, 3]
      )
      observation_noise_variance = np.array([1e-9], np.float64)
      observation_index_points = np.random.uniform(
          -1.0, 1.0, (1, 1, 7, 2)
      ).astype(np.float64)
      observations = np.random.uniform(-1.0, 1.0, (1, 1, 7)).astype(
          np.float64
      )
      index_points = np.random.uniform(-1.0, 1.0, (6, 2)).astype(
          np.float64
      )
      kernel = exponentiated_quadratic.ExponentiatedQuadratic(
          amplitude, length_scale
      )
  
      def cholesky_fn(x):
          return tf.linalg.cholesky(
              tf.linalg.set_diag(x, tf.linalg.diag_part(x) + 1.0)
          )
  
      dist = stprm.StudentTProcessRegressionModel(
          df=np.float64(5.0),
          kernel=kernel,
          index_points=index_points,
          observation_index_points=observation_index_points,
          observations=observations,
          observation_noise_variance=observation_noise_variance,
          cholesky_fn=cholesky_fn,
      )
  
      flat = tf.nest.flatten(dist, expand_composites=True)
      unflat = tf.nest.pack_sequence_as(
          dist, flat, expand_composites=True
      )
      self.assertIsInstance(
          unflat, stprm.StudentTProcessRegressionModel
      )
      # Check that we don't recompute the divisor matrix on flattening /
      # unflattening.
      self.assertIs(
          dist.kernel.schur_complement._precomputed_divisor_matrix_cholesky,
          unflat.kernel.schur_complement._precomputed_divisor_matrix_cholesky,
      )
  
      x = self.evaluate(dist.sample(3, seed=test_util.test_seed()))
      actual = self.evaluate(dist.log_prob(x))
      self.assertAllClose(self.evaluate(unflat.log_prob(x)), actual)
  
imports: from unittest import mock
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import gaussian_process_regression_model
  from tensorflow_probability.python.distributions import student_t_process
  from tensorflow_probability.python.distributions import student_t_process_regression_model
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math.psd_kernels import exp_sin_squared
  from tensorflow_probability.python.math.psd_kernels import exponentiated_quadratic
  from tensorflow_probability.python.math.psd_kernels.internal import test_util
label_desc: Use image node_id 8 for calling the StudentTProcessRegressionModelTest obj's underlying member method code with example usage: obj.testCompositeTensorOrPytree() and returns: tf