code: def _boolean_index_to_array(idx):
      if idx.ndim > 1:
          raise IndexError("invalid index shape")
      idx = cupy.array(idx, dtype=idx.dtype)
      return cupy.where(idx)[0]
  
imports: import cupy
  from cupy import _core
  from cupyx.scipy.sparse._base import isspmatrix
  from cupyx.scipy.sparse._base import spmatrix
  from cupy.cuda import device
  from cupy.cuda import runtime
  import numpy
label_desc: Use image node_id 13 for calling a global function with example usage: _boolean_index_to_array(idx) and returns: cupy