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 = cupy.asarray(points[0])
      if isinstance(points, tuple):
          p = cupy.broadcast_arrays(*[cupy.asarray(x) for x in points])
          p = [cupy.expand_dims(x, -1) for x in p]
          points = cupy.concatenate(p, axis=-1)
      else:
          points = cupy.asarray(points)
          if points.ndim == 1:
              if ndim is None:
                  points = points.reshape(-1, 1)
              else:
                  points = points.reshape(-1, ndim)
      return points
  
imports: import math
  import cupy
  from cupy._core import internal
  from cupy._core._scalar import get_typename
  from cupy_backends.cuda.api import runtime
  from cupyx.scipy import special
  from cupyx.scipy.interpolate._bspline import BSpline, _get_dtype
  import numpy
label_desc: Use image node_id 7 for calling a global function with example usage: _ndim_coords_from_arrays(points, ndim) and returns: points