code: def _interpolate_nd_with_x(
      data: np.ndarray,
      n: int,
      scale_factors: list[float],
      output_size: list[int],
      x: list[float],
      get_coeffs: Callable[[float, float], np.ndarray],
      roi: np.ndarray | None = None,
      exclude_outside: bool = False,
      **kwargs: Any,
  ) -> np.ndarray:
      if n == 1:
          return _interpolate_1d_with_x(
              data,
              scale_factors[0],
              output_size[0],
              x[0],
              get_coeffs,
              roi=roi,
              exclude_outside=exclude_outside,
              **kwargs,
          )
      res1d = []
      for i in range(data.shape[0]):
          r = _interpolate_nd_with_x(
              data[i],
              n - 1,
              scale_factors[1:],
              output_size[1:],
              x[1:],
              get_coeffs,
              roi=None
              if roi is None
              else np.concatenate([roi[1:n], roi[n + 1 :]]),
              exclude_outside=exclude_outside,
              **kwargs,
          )
          res1d.append(r)
  
      return _interpolate_1d_with_x(
          res1d,  # type: ignore[arg-type]  # FIXME
          scale_factors[0],
          output_size[0],
          x[0],
          get_coeffs,
          roi=None if roi is None else [roi[0], roi[n]],  # type: ignore[arg-type]  # FIXME
          exclude_outside=exclude_outside,
          **kwargs,
      )
  
file_path: onnx/onnx/reference/ops/op_resize.py
imports: from __future__ import annotations
  from typing import Any, Callable
  import numpy
  from onnx.reference.op_run import OpRun
label_desc: Use image node_id 10 for calling a global function with example usage: _interpolate_nd_with_x(data, n, scale_factors, output_size, x, get_coeffs, roi, exclude_outside) and returns: _interpolate_1d_with_x, _interpolate_1d_with_x