code: def test_1d_function_on_nonlinear_grid(self):
      x_min, x_max = 0.0, 3.0
      x_grid = np.linspace(x_min, x_max, num=100, dtype=np.float32) ** 2
      y_ref = tf.sin(x_grid)
  
      # Argument `x` must be shape [..., D, nd] = [50, 1].
      x = tf.linspace(x_min, x_max, 50)[..., tf.newaxis]
  
      y = interpolation.batch_interp_rectilinear_nd_grid(
          x, (x_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 * (x_grid[-1] - x_grid[-2])
      expected_y = tf.sin(x[:, 0])
  
      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 4 for calling the BatchInterpRectilinearNDGridTest obj's underlying member method code with example usage: obj.test_1d_function_on_nonlinear_grid() without return types