code: def _ndim_coords_from_arrays(points, ndim=None):
      """
      Convert a tuple of coordinate arrays to a (..., ndim)-shaped array.
      """
      if isinstance(points, tuple) and len(points) == 1:
          # handle argument tuple
          points = points[0]
      if isinstance(points, tuple):
          p = cp.broadcast_arrays(*points)
          n = len(p)
          for j in range(1, n):
              if p[j].shape != p[0].shape:
                  raise ValueError(
                      "coordinate arrays do not have the same shape"
                  )
          points = cp.empty(p[0].shape + (len(points),), dtype=float)
          for j, item in enumerate(p):
              points[..., j] = item
      else:
          points = cp.asanyarray(points)
          if points.ndim == 1:
              if ndim is None:
                  points = points.reshape(-1, 1)
              else:
                  points = points.reshape(-1, ndim)
      return points
  
imports: import itertools
  import cupy
  from cupyx.scipy.interpolate._bspline2 import make_interp_spline
  from cupyx.scipy.interpolate._cubic import PchipInterpolator
label_desc: Use image node_id 1 for calling a global function with example usage: _ndim_coords_from_arrays(points, ndim) and returns: points