code: def _from_chx(array, check_backprop=True):
      # Converts chainerx.ndarray to numpy/cupy.ndarray.
      # Objects with other types are kept intact.
      # Returns a pair: (xp, cupy device or dummy context, numpy/cupy.ndarray).
      if not isinstance(array, chainerx.ndarray):
          if isinstance(array, numpy.ndarray) or (
              cupy and isinstance(array, cupy.ndarray)
          ):
              raise TypeError(
                  "ChainerX function fallback using NumPy/CuPy arrays "
                  "is not supported."
              )
          # _from_chx is also called for slice and tuple objects
          # Used to index a chx array
          return None, _dummy_context, array
      if check_backprop and array.is_backprop_required():
          raise RuntimeError(
              "ChainerX function fallback using NumPy/CuPy is not "
              "supported for arrays that are connected to a graph."
          )
      backend_name = array.device.backend.name
      if backend_name == "native":
          return numpy, _dummy_context, _to_numpy(array)
      if backend_name == "cuda":
          if cupy is None:
              raise RuntimeError(
                  "ChainerX fallback implementation for cuda backend requires "
                  "cupy to be installed."
              )
          array_cupy = _to_cupy(array)
          return cupy, array_cupy.device, array_cupy
      raise RuntimeError(
          "ChainerX fallback implementation only supports native or cuda "
          "backends."
      )
  
file_path: chainer/chainerx/_fallback_workarounds.py
imports: import numpy
  import chainerx
label_desc: Use image node_id 5 for calling a global function with example usage: _from_chx(array, check_backprop) and returns: None,  _dummy_context,  array, numpy,  _dummy_context,  _to_numpy, cupy,  array_cupy,  array_cupy