code: def test_nonscalar_values_linear_2D(self):
      # Verify that non-scalar values work in the 2D fast path
      method = "linear"
      points = [
          (0.0, 0.5, 1.0, 1.5, 2.0, 2.5),
          (0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0),
      ]
  
      rng = cp.random.default_rng(1234)
  
      trailing_points = (3, 4)
      # NB: values has a `num_trailing_dims` trailing dimension
      values = rng.random((6, 7, *trailing_points))
      sample = rng.random(2)  # a single sample point !
  
      interp = RegularGridInterpolator(
          points, values, method=method, bounds_error=False
      )
      v = interp(sample)
  
      # v has a single sample point *per entry in the trailing dimensions*
      assert v.shape == (1, *trailing_points)
  
      # check the values, too : manually loop over the trailing dimensions
      vs = cp.empty((values.shape[-2:]))
      for i in range(values.shape[-2]):
          for j in range(values.shape[-1]):
              interp = RegularGridInterpolator(
                  points,
                  values[..., i, j],
                  method=method,
                  bounds_error=False,
              )
              vs[i, j] = interp(sample)
      v2 = cp.expand_dims(vs, axis=0)
      assert_allclose(v, v2, atol=1e-14, err_msg=method)
  
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 26 for calling the TestRegularGridInterpolator obj's underlying member method code with example usage: obj.test_nonscalar_values_linear_2D() without return types