code: def test_pairwise_kernels_basic():
      X = np.zeros((4, 4))
      # standard kernel with no argument
      pairwise_kernels(X, metric="chi2")
      pairwise_kernels(X, metric="linear")
      # standard kernel with correct kwd argument
      pairwise_kernels(X, metric="chi2", gamma=1.0)
      # standard kernel with incorrect kwd argument
      with pytest.raises(
          ValueError,
          match="kwds contains arguments not used by kernel function",
      ):
          pairwise_kernels(X, metric="linear", wrong_parameter_name=1.0)
      # standard kernel with filtered kwd argument
      pairwise_kernels(
          X, metric="rbf", filter_params=True, wrong_parameter_name=1.0
      )
  
      # incorrect function type
      def non_numba_kernel(x, y):
          return x.dot(y)
  
      with pytest.raises(
          TypeError,
          match="Kernel function should be a numba device function.",
      ):
          pairwise_kernels(X, metric=non_numba_kernel)
  
      # correct function type
      @cuda.jit(device=True)
      def numba_kernel(x, y, special_argument=3.0):
          return 1 + 2
  
      pairwise_kernels(X, metric=numba_kernel)
      pairwise_kernels(X, metric=numba_kernel, special_argument=1.0)
  
      # malformed function
      @cuda.jit(device=True)
      def bad_numba_kernel(x):
          return 1 + 2
  
      with pytest.raises(
          ValueError,
          match="Expected at least two arguments to kernel function.",
      ):
          pairwise_kernels(X, metric=bad_numba_kernel)
  
      # malformed function 2 - No default value
      @cuda.jit(device=True)
      def bad_numba_kernel2(x, y, z):
          return 1 + 2
  
      with pytest.raises(
          ValueError,
          match="Extra kernel parameters "
          "must be passed as keyword arguments.",
      ):
          pairwise_kernels(X, metric=bad_numba_kernel2)
  
      # Precomputed
      assert np.allclose(X, pairwise_kernels(X, metric="precomputed"))
  
imports: from cuml.testing.utils import as_type
  from hypothesis.extra.numpy import arrays
  from hypothesis import given, settings, assume, strategies
  from sklearn.kernel_ridge import KernelRidge
  import inspect
  import math
  import pytest
  from sklearn.metrics.pairwise import pairwise_kernels
  from cuml.metrics import pairwise_kernels, PAIRWISE_KERNEL_FUNCTIONS
  from cuml import KernelRidge
  from cuml.internals.safe_imports import cpu_only_import
  from cuml.internals.safe_imports import gpu_only_import_from
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 2 for calling a global function with example usage: test_pairwise_kernels_basic() and returns: x, unknown, unknown, unknown