code: def register_cupy():
      import cupy
  
      concatenate_lookup.register(cupy.ndarray, cupy.concatenate)
      tensordot_lookup.register(cupy.ndarray, cupy.tensordot)
      percentile_lookup.register(cupy.ndarray, percentile)
      numel_lookup.register(cupy.ndarray, _numel_arraylike)
      nannumel_lookup.register(cupy.ndarray, _nannumel)
  
      @to_numpy_dispatch.register(cupy.ndarray)
      def cupy_to_numpy(data, **kwargs):
          return cupy.asnumpy(data, **kwargs)
  
      @to_cupy_dispatch.register(np.ndarray)
      def numpy_to_cupy(data, **kwargs):
          return cupy.asarray(data, **kwargs)
  
      @einsum_lookup.register(cupy.ndarray)
      def _cupy_einsum(*args, **kwargs):
          # NB: cupy does not accept `order` or `casting` kwargs - ignore
          kwargs.pop("casting", None)
          kwargs.pop("order", None)
          return cupy.einsum(*args, **kwargs)
  
imports: from __future__ import annotations
  import math
  import numpy
  from dask.array import chunk
  from dask.array.core import Array
  from dask.array.dispatch import concatenate_lookup, divide_lookup, einsum_lookup, empty_lookup, nannumel_lookup, numel_lookup, percentile_lookup, tensordot_lookup, to_cupy_dispatch, to_numpy_dispatch
  from dask.array.numpy_compat import divide
  from dask.array.numpy_compat import ma_divide
  from dask.array.percentile import _percentile
  from dask.backends import CreationDispatch, DaskBackendEntrypoint
label_desc: Use image node_id 4 for calling a global function with example usage: register_cupy() and returns: cupy, cupy, cupy