code: def _convert_to_numpy(array, xp):
      """Convert X into a NumPy ndarray on the CPU."""
      xp_name = xp.__name__
  
      if xp_name in {"array_api_compat.torch", "torch"}:
          return array.cpu().numpy()
      elif xp_name == "cupy.array_api":
          return array._array.get()
      elif xp_name in {
          "array_api_compat.cupy",
          "cupy",
      }:  # pragma: nocover
          return array.get()
  
      return numpy.asarray(array)
  
imports: import math
  from functools import wraps
  import numpy
  import scipy.special
  from .._config import get_config
  from .fixes import parse_version
label_desc: Use image node_id 12 for calling a global function with example usage: _convert_to_numpy(array, xp) and returns: numpy, array, array, array