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 = broadcast_arrays(*points)
          for p_other in p[1:]:
              if p_other.shape != p[0].shape:
                  raise ValueError(
                      "coordinate arrays do not have the same shape"
                  )
          points = empty(p[0].shape + (len(points),), dtype=float)
          for j, item in enumerate(p):
              points = points.at[..., j].set(item)
      else:
          check_arraylike("_ndim_coords_from_arrays", points)
          points = asarray(points)  # SciPy: asanyarray(points)
          if points.ndim == 1:
              if ndim is None:
                  points = points.reshape(-1, 1)
              else:
                  points = points.reshape(-1, ndim)
      return points
  
file_path: jax/jax/_src/third_party/scipy/interpolate.py
imports: from itertools import product
  import scipy.interpolate
  from jax.numpy import asarray, broadcast_arrays, can_cast, empty, nan, searchsorted, where, zeros
  from jax._src.tree_util import register_pytree_node
  from jax._src.numpy.util import check_arraylike, promote_dtypes_inexact, _wraps
label_desc: Use image node_id 1 for calling a global function with example usage: _ndim_coords_from_arrays(points, ndim) and returns: points