code: def testBindingIndexPoints(self, num_tasks):
      amplitude = np.float64(0.5)
      length_scale = np.float64(2.0)
      kernel = exponentiated_quadratic.ExponentiatedQuadratic(
          amplitude, length_scale
      )
  
      # 5x5 grid of index points in R^2 and flatten to 9x2
      index_points = np.linspace(-4.0, 4.0, 3, dtype=np.float64)
      index_points = np.stack(
          np.meshgrid(index_points, index_points), axis=-1
      )
      observation_index_points = np.reshape(index_points, [-1, 2])
      # ==> shape = [9, 2]
  
      observations = np.linspace(-20.0, 20.0, 9 * num_tasks).reshape(
          9, num_tasks
      )
  
      multi_task_kernel = multitask_kernel.Independent(
          num_tasks=num_tasks, base_kernel=kernel
      )
      observation_noise_variance = np.float64(1e-2)
      mtgp = mtgprm_lib.MultiTaskGaussianProcessRegressionModel(
          kernel=multi_task_kernel,
          observation_index_points=observation_index_points,
          observations=observations,
          observation_noise_variance=observation_noise_variance,
          validate_args=True,
      )
      gp = gprm.GaussianProcessRegressionModel(
          kernel=kernel,
          observation_index_points=observation_index_points,
          # Batch of num_task observations.
          observations=tf.linalg.matrix_transpose(observations),
          observation_noise_variance=observation_noise_variance,
          validate_args=True,
      )
  
      test_points = np.random.uniform(-1.0, 1.0, [10, 2])
      test_observations = np.random.uniform(-1.0, 1.0, [10, num_tasks])
  
      multi_task_log_prob = mtgp.log_prob(
          test_observations, index_points=test_points
      )
      # Reduce over the first dimension which is tasks.
      single_task_log_prob = tf.reduce_sum(
          gp.log_prob(
              tf.linalg.matrix_transpose(test_observations),
              index_points=test_points,
          ),
          axis=0,
      )
      self.assertAllClose(
          self.evaluate(single_task_log_prob),
          self.evaluate(multi_task_log_prob),
          rtol=1e-5,
      )
  
      multi_task_mean_ = self.evaluate(
          mtgp.mean(index_points=test_points)
      )
      # Reshape so that task dimension is last.
      single_task_mean_ = np.swapaxes(
          self.evaluate(gp.mean(index_points=test_points)), -1, -2
      )
      self.assertAllClose(
          single_task_mean_, multi_task_mean_, rtol=1e-5
      )
  
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 4 for calling the MultiTaskGaussianProcessRegressionModelTest obj's underlying member method code with example usage: obj.testBindingIndexPoints(num_tasks) without return types