code: def _kernel_count():
      return _core.ElementwiseKernel(
          "",
          "raw Y y, raw int32 count",
          """
          if (y[i] < 0) continue;
          int j = i;
          while (j != y[j]) { j = y[j]; }
          if (j != i) y[i] = j;
          else atomicAdd(&count[0], 1);
          """,
          "cupyx_scipy_ndimage_label_count",
      )
  
imports: import warnings
  import numpy
  import cupy
  from cupy import _core
  from cupy import _util
label_desc: Use image node_id 6 for calling a global function with example usage: _kernel_count() and returns: _core