code: def testMeanVarianceAndCovariancePrecomputed(
      self, has_missing_observations
  ):
      num_tasks = 3
      num_obs = 7
      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, num_obs, 2)
      ).astype(np.float64)
      observations = (
          np.linspace(-20.0, 20.0, num_obs * num_tasks)
          .reshape(num_obs, num_tasks)
          .astype(np.float64)
      )
  
      if has_missing_observations:
          observations_is_missing = np.stack(
              [np.random.randint(2, size=(num_obs,))] * num_tasks,
              axis=-1,
          ).astype(np.bool_)
      else:
          observations_is_missing = None
  
      index_points = np.random.uniform(-1.0, 1.0, (6, 2)).astype(
          np.float64
      )
  
      kernel = exponentiated_quadratic.ExponentiatedQuadratic(
          amplitude, length_scale
      )
      multi_task_kernel = multitask_kernel.Independent(
          num_tasks=num_tasks, base_kernel=kernel
      )
      mtgprm = mtgprm_lib.MultiTaskGaussianProcessRegressionModel(
          kernel=multi_task_kernel,
          index_points=index_points,
          observation_index_points=observation_index_points,
          observations=observations,
          observation_noise_variance=observation_noise_variance,
          observations_is_missing=observations_is_missing,
          validate_args=True,
      )
  
      precomputed_mtgprm = mtgprm_lib.MultiTaskGaussianProcessRegressionModel.precompute_regression_model(
          kernel=multi_task_kernel,
          index_points=index_points,
          observation_index_points=observation_index_points,
          observations=observations,
          observation_noise_variance=observation_noise_variance,
          observations_is_missing=observations_is_missing,
          validate_args=True,
      )
  
      mock_cholesky_fn = mock.Mock(return_value=None)
      rebuilt_precomputed_mtgprm = mtgprm_lib.MultiTaskGaussianProcessRegressionModel.precompute_regression_model(
          kernel=multi_task_kernel,
          index_points=index_points,
          observation_index_points=observation_index_points,
          observations=observations,
          observation_noise_variance=observation_noise_variance,
          observations_is_missing=observations_is_missing,
          _precomputed_divisor_matrix_cholesky=precomputed_mtgprm._precomputed_divisor_matrix_cholesky,
          _precomputed_solve_on_observation=precomputed_mtgprm._precomputed_solve_on_observation,
          cholesky_fn=mock_cholesky_fn,
          validate_args=True,
      )
      mock_cholesky_fn.assert_not_called()
  
      rebuilt_precomputed_mtgprm = rebuilt_precomputed_mtgprm.copy(
          cholesky_fn=None
      )
      self.assertAllClose(
          self.evaluate(precomputed_mtgprm.variance()),
          self.evaluate(mtgprm.variance()),
      )
      self.assertAllClose(
          self.evaluate(precomputed_mtgprm.mean()),
          self.evaluate(mtgprm.mean()),
      )
      self.assertAllClose(
          self.evaluate(rebuilt_precomputed_mtgprm.variance()),
          self.evaluate(mtgprm.variance()),
      )
      self.assertAllClose(
          self.evaluate(rebuilt_precomputed_mtgprm.mean()),
          self.evaluate(mtgprm.mean()),
      )
  
imports: from unittest import mock
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import gaussian_process_regression_model
  from tensorflow_probability.python.distributions import uniform
  from tensorflow_probability.python.experimental.distributions import multitask_gaussian_process_regression_model
  from tensorflow_probability.python.experimental.psd_kernels import multitask_kernel
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import test_util
  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 10 for calling the MultiTaskGaussianProcessRegressionModelTest obj's underlying member method code with example usage: obj.testMeanVarianceAndCovariancePrecomputed(has_missing_observations) without return types