code: def test_2d_function_on_nonlinear_grid(self):
      x0_min, x0_max = 0.0, 3.0
      x1_min, x1_max = -1.0, 1.0
      x0_grid = (
          np.linspace(x0_min, x0_max, num=50, dtype=np.float32) ** 2
      )
      x1_grid = (
          np.linspace(x1_min, x1_max, num=50, dtype=np.float32) ** 3
      )
      x0_mesh, x1_mesh = np.meshgrid(x0_grid, x1_grid, indexing="ij")
  
      def f(x0, x1):
          return tf.sin(x0) * tf.cos(x1)
  
      y_ref = f(x0_mesh, x1_mesh)
  
      # Argument `x` must be shape [..., D, nd] = [50, 2].
      rng = np.random.RandomState(42)
      x0 = x0_min + (x0_max - x0_min) * rng.rand(50).astype(np.float32)
      x1 = x1_min + (x1_max - x1_min) * rng.rand(50).astype(np.float32)
      x = tf.stack((x0, x1), axis=-1)
  
      y = interpolation.batch_interp_rectilinear_nd_grid(
          x, (x0_grid, x1_grid), y_ref, axis=0
      )
  
      # Linear interpolation of f(x) leads to error bounded by
      #   Max{|f''|} * Max{Δx}.
      # Put a '2' in front for safety.
      atol = 2.0 * (x0_grid[-1] - x0_grid[-2])
      expected_y = f(x0, x1)
  
      self.assertAllClose(
          self.evaluate(y), self.evaluate(expected_y), atol=atol
      )
  
imports: import numpy
  from scipy import interpolate
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
  from tensorflow_probability.python.math import interpolation
label_desc: Use image node_id 5 for calling the BatchInterpRectilinearNDGridTest obj's underlying member method code with example usage: obj.test_2d_function_on_nonlinear_grid() and returns: unknown