code: def test_nan_x_2d(self, method):
      x, y = cp.array([0, 1, 2]), cp.array([1, 3, 7])
  
      def f(x, y):
          return x**2 + y**2
  
      xg, yg = cp.meshgrid(x, y, indexing="ij", sparse=True)
      data = f(xg, yg)
      interp = RegularGridInterpolator(
          (x, y), data, method=method, bounds_error=False
      )
  
      res = interp([[1.5, cp.nan], [1, 1]])
      assert_allclose(res[1], 2, atol=1e-14)
      assert cp.isnan(res[0])
  
      # test arbitrary nan pattern
      rng = cp.random.default_rng(8143215468)
      x = rng.random(size=100) * 4 - 1
      y = rng.random(size=100) * 8
      i1 = rng.random(size=100) > 0.5
      i2 = rng.random(size=100) > 0.5
      i = i1 | i2
      x[i1] = cp.nan
      y[i2] = cp.nan
      z = cp.array([x, y]).T
      # out-of-bounds comparisons, `out_of_bounds += x < grid[0]`,
      # generate numpy warnings if `x` contains nans.
      # These warnings should propagate to user (since `x` is user
      # input)
      res = interp(z)
  
      assert_array_equal(res[i], cp.nan)
      assert_array_equal(res[~i], interp(z[~i]))
  
imports: import pytest
  import cupy
  from cupy.testing import assert_allclose, assert_array_equal, assert_array_almost_equal
  from cupy_backends.cuda.api import runtime
  from pytest import raises
  from cupyx.scipy.interpolate import RegularGridInterpolator, interpn
label_desc: Use image node_id 20 for calling the TestRegularGridInterpolator obj's underlying member method code with example usage: obj.test_nan_x_2d(method) and returns: unknown