code: def test_2d_scalar_valued_no_leading_dims(self):
      y_ref = [[0.0, 1.0], [2.0, 3.0]]
      y = self.batch_interp_regular_nd_grid_fn(
          # Interpolate at one single point.
          x=[[0.0, 0.0]],
          x_ref_min=[0.0, 0.0],
          x_ref_max=[1.0, 1.0],
          y_ref=y_ref,
          axis=-2,
      )
      # Test x at the upper left grid point.
      self.assertAllClose([0.0], self.evaluate(y))
  
      # Test x at all grid points
      y = self.batch_interp_regular_nd_grid_fn(
          x=[[0.0, 0.0], [0.0, 1.0], [1.0, 0.0], [1.0, 1.0]],
          x_ref_min=[0.0, 0.0],
          x_ref_max=[1.0, 1.0],
          y_ref=y_ref,
          axis=-2,
      )
      self.assertAllClose([0.0, 1.0, 2.0, 3.0], self.evaluate(y))
  
      # Test x at intermediate grid points, outside points, and NaN.
      y = self.batch_interp_regular_nd_grid_fn(
          x=[
              [0.0, 0.5],
              [0.5, 0.0],
              [1.0, np.nan],
              [np.nan, 1.0],
              # [0, 1] is the same as [0, 2], since we snap values outside the
              # grid back on to the grid.
              [0.0, 1.0],
              [0.0, 2.0],
          ],
          x_ref_min=[0.0, 0.0],
          x_ref_max=[1.0, 1.0],
          y_ref=y_ref,
          axis=-2,
      )
      self.assertAllClose(
          [0.5, 1.0, np.nan, np.nan, 1.0, 1.0], self.evaluate(y)
      )
  
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 1 for calling the BaseBatchInterpNDGridTest obj's underlying member method code with example usage: obj.test_2d_scalar_valued_no_leading_dims() without return types