code: def _get_interp_kernel(is_complex):
      in_params = "raw V x, raw U idx, "
      in_params += "raw W fx, raw Y fy, U len, raw Y left, raw Y right"
      out_params = "Z y"  # output dtype follows NumPy's
  
      if is_complex:
          preamble = "typedef double real_t;\n"
      else:
          preamble = "typedef Z real_t;\n"
      preamble += "typedef Z value_t;\n"
      preamble += cupy._sorting.search._preamble  # for _isnan
  
      code = r"""
          U x_idx = idx[i] - 1;
  
          if ( _isnan<V>(x[i]) ) { y = x[i]; }
          else if (x_idx < 0) { y = left[0]; }
          else if (x[i] == fx[len - 1]) {
              // searchsorted cannot handle both of the boundary points,
              // so we must detect and correct ourselves...
              y = fy[len - 1];
          }
          else if (x_idx >= len - 1) { y = right[0]; }
          else {
              const Z slope = (value_t)(fy[x_idx+1] - fy[x_idx]) / \
                              ((real_t)fx[x_idx+1] - (real_t)fx[x_idx]);
              Z out = slope * ((real_t)x[i] - (real_t)fx[x_idx]) \
                      + (value_t)fy[x_idx];
              if (_isnan<Z>(out)) {
                  out = slope * ((real_t)x[i] - (real_t)fx[x_idx+1]) \
                        + (value_t)fy[x_idx+1];
                  if (_isnan<Z>(out) && (fy[x_idx] == fy[x_idx+1])) {
                      out = fy[x_idx];
                  }
              }
              y = out;
          }
      """
      return cupy.ElementwiseKernel(
          in_params, out_params, code, "cupy_interp", preamble=preamble
      )
  
file_path: cupy/cupy/_math/misc.py
imports: import cupy
  import cupyx.scipy.fft
  from cupy import _core
  from cupy._core import _routines_math
  from cupy._core import fusion
  from cupy.lib import stride_tricks
  import numpy
label_desc: Use image node_id 10 for calling a global function with example usage: _get_interp_kernel(is_complex) and returns: cupy