code: def test_gradient_non_nan(self):
      x_obs = normal.Normal(0.0, 1.0).sample(
          (10, 2, 6), seed=test_util.test_seed()
      )
      y_obs = tf.reduce_sum(x_obs, axis=(-1, -2))
      x_obs = tf.concat(
          [x_obs, np.full([3, 2, 6], np.nan, dtype=np.float32)], axis=0
      )
      y_obs = tf.concat(
          [y_obs, np.full([3], np.nan, dtype=np.float32)], axis=0
      )
      is_missing = np.array([False] * 10 + [True] * 3)
  
      def loss(length_scales):
          kernel = psd_kernels.MaternFiveHalves(
              amplitude=tf.math.sqrt(1e-2), feature_ndims=2
          )
          kernel = psd_kernels.FeatureScaled(
              kernel, scale_diag=tf.math.sqrt(length_scales)
          )
          return gaussian_process.GaussianProcess(
              kernel,
              index_points=x_obs,
              observation_noise_variance=1.0,
          ).log_prob(y_obs, is_missing=is_missing)
  
      lscales = tf.convert_to_tensor(
          [
              [
                  11.67385626,
                  0.21246016,
                  0.0215677,
                  0.08823962,
                  0.22416186,
                  0.06885594,
              ]
          ]
          * 2
      )
  
      def _grad(lscales):
          return gradient.value_and_gradient(loss, lscales)[1]
  
      self.assertAllNotNan(_grad(lscales))
  
imports: 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.distributions import mvn_diag
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
  from tensorflow_probability.python.math import psd_kernels
  from tensorflow_probability.python.math.psd_kernels.internal import test_util
label_desc: Use image node_id 2 for calling the GaussianProcessStaticTest obj's underlying member method code with example usage: obj.test_gradient_non_nan() and returns: gaussian_process, gradient