code: def testShapes(self):
      # We'll use a batch shape of [2, 3, 5, 7, 11]
  
      # 5x5 grid of index points in R^2 and flatten to 25x2
      index_points = np.linspace(-4.0, 4.0, 5, dtype=np.float64)
      index_points = np.stack(
          np.meshgrid(index_points, index_points), axis=-1
      )
      index_points = np.reshape(index_points, [-1, 2])
      # ==> shape = [25, 2]
      batched_index_points = np.reshape(index_points, [1, 1, 25, 2])
      batched_index_points = np.stack([batched_index_points] * 5)
      # ==> shape = [5, 1, 1, 25, 2]
  
      # Kernel with batch_shape [2, 3, 1, 1, 1]
      amplitude = np.array([1.0, 2.0], np.float64).reshape(
          [2, 1, 1, 1, 1]
      )
      length_scale = np.array([0.1, 0.2, 0.3], np.float64).reshape(
          [1, 3, 1, 1, 1]
      )
      observation_noise_variance = np.array([1e-9], np.float64).reshape(
          [1, 1, 1, 1, 1]
      )
  
      jitter = np.float64(1e-6)
      observation_index_points = np.random.uniform(
          -1.0, 1.0, (7, 1, 7, 2)
      ).astype(np.float64)
      observations = np.random.uniform(-1.0, 1.0, (11, 7)).astype(
          np.float64
      )
  
      def cholesky_fn(x):
          return tf.linalg.cholesky(
              tf.linalg.set_diag(x, tf.linalg.diag_part(x) + 1.0)
          )
  
      if not self.is_static:
          amplitude = tf1.placeholder_with_default(
              amplitude, shape=None
          )
          length_scale = tf1.placeholder_with_default(
              length_scale, shape=None
          )
          batched_index_points = tf1.placeholder_with_default(
              batched_index_points, shape=None
          )
  
          observation_index_points = tf1.placeholder_with_default(
              observation_index_points, shape=None
          )
          observations = tf1.placeholder_with_default(
              observations, shape=None
          )
  
      kernel = exponentiated_quadratic.ExponentiatedQuadratic(
          amplitude, length_scale
      )
  
      dist = gprm.GaussianProcessRegressionModel(
          kernel,
          batched_index_points,
          observation_index_points,
          observations,
          observation_noise_variance,
          cholesky_fn=cholesky_fn,
          jitter=jitter,
          validate_args=True,
      )
  
      batch_shape = [2, 3, 5, 7, 11]
      event_shape = [25]
      sample_shape = [9, 3]
  
      samples = dist.sample(sample_shape, seed=test_util.test_seed())
  
      self.assertIs(cholesky_fn, dist.cholesky_fn)
  
      if self.is_static or tf.executing_eagerly():
          self.assertAllEqual(dist.batch_shape_tensor(), batch_shape)
          self.assertAllEqual(dist.event_shape_tensor(), event_shape)
          self.assertAllEqual(
              samples.shape, sample_shape + batch_shape + event_shape
          )
          self.assertAllEqual(dist.batch_shape, batch_shape)
          self.assertAllEqual(dist.event_shape, event_shape)
          self.assertAllEqual(
              samples.shape, sample_shape + batch_shape + event_shape
          )
      else:
          self.assertAllEqual(
              self.evaluate(dist.batch_shape_tensor()), batch_shape
          )
          self.assertAllEqual(
              self.evaluate(dist.event_shape_tensor()), event_shape
          )
          self.assertAllEqual(
              self.evaluate(samples).shape,
              sample_shape + batch_shape + event_shape,
          )
          self.assertIsNone(tensorshape_util.rank(samples.shape))
          self.assertIsNone(tensorshape_util.rank(dist.batch_shape))
          self.assertEqual(tensorshape_util.rank(dist.event_shape), 1)
          self.assertIsNone(
              tf.compat.dimension_value(
                  tensorshape_util.dims(dist.event_shape)[0]
              )
          )
  
imports: from unittest import mock
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import gaussian_process
  from tensorflow_probability.python.distributions import gaussian_process_regression_model
  from tensorflow_probability.python.internal import tensorshape_util
  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 1 for calling the _GaussianProcessRegressionModelTest obj's underlying member method code with example usage: obj.testShapes() and returns: tf