code: def assert_dbscan_equal(ref, actual, X, core_indices, eps):
      """
      Utility function to compare two numpy label arrays.
      The labels of core/noise points are expected to be equal, and the labels
      of border points are verified by finding a neighboring core point with the
      same label.
      """
      core_set = set(core_indices)
      N, _ = X.shape
      eps2 = eps**2
  
      def sqnorm(x):
          return np.inner(x, x)
  
      for i in range(N):
          la, lb = ref[i], actual[i]
  
          if i in core_set:  # core point
              assert la == lb, (
                  "Core point mismatch at #{}: "
                  "{} (expected {})".format(i, lb, la)
              )
          elif la == -1:  # noise point
              assert lb == -1, "Noise mislabelled at #{}: {}".format(
                  i, lb
              )
          else:  # border point
              found = False
              for j in range(N):
                  # Check if j is a core point with the same label
                  if j in core_set and lb == actual[j]:
                      # Check if j is a neighbor of i
                      if sqnorm(X[i] - X[j]) <= eps2:
                          found = True
                          break
              assert found, (
                  "Border point not connected to cluster at #{}: "
                  "{} (reference: {})".format(i, lb, la)
              )
  
imports: import pytest
  from cuml.internals.mem_type import MemoryType
  from cuml.internals.input_utils import input_to_cuml_array, is_array_like
  from cuml.internals.base import Base
  import cuml
  from sklearn.model_selection import train_test_split
  from sklearn.metrics import mean_squared_error, brier_score_loss
  from sklearn.datasets import make_classification, make_regression
  from sklearn import datasets
  from pylibraft.common.cuda import Stream
  from sklearn.datasets import make_regression
  from numba.cuda.cudadrv.devicearray import DeviceNDArray
  from numbers import Number
  from cuml.internals.safe_imports import gpu_only_import_from
  from itertools import dropwhile
  from copy import deepcopy
  from cuml.internals.safe_imports import cpu_only_import
  import inspect
  from textwrap import dedent, indent
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 8 for calling a global function with example usage: assert_dbscan_equal(ref, actual, X, core_indices, eps) and returns: np