code: def test_deep_kernel(deep_kernel_params):
      (
          n_features,
          n_instances,
          kernel_a,
          kernel_b,
          eps,
      ) = deep_kernel_params
      xshape, yshape = (n_instances[0], n_features), (
          n_instances[1],
          n_features,
      )
      x = torch.as_tensor(np.random.random(xshape).astype("float32"))
      y = torch.as_tensor(np.random.random(yshape).astype("float32"))
  
      proj = nn.Linear(n_features, n_features)
      kernel_a = (
          kernel_a(n_features) if kernel_a == MyKernel else kernel_a
      )
      kernel_b = (
          kernel_b(n_features) if kernel_b == MyKernel else kernel_b
      )
  
      kernel = DeepKernel(
          proj, kernel_a=kernel_a, kernel_b=kernel_b, eps=eps
      )
  
      k_xy = kernel(x, y).detach().numpy()
      k_yx = kernel(y, x).detach().numpy()
      k_xx = kernel(x, x).detach().numpy()
      assert k_xy.shape == n_instances and k_xx.shape == (
          xshape[0],
          xshape[0],
      )
      assert (np.diag(k_xx) > 0.0).all()
      np.testing.assert_almost_equal(
          k_xy, np.transpose(k_yx), decimal=5
      )
  
file_path: alibi-detect/alibi_detect/utils/pytorch/tests/test_kernels_pt.py
imports: from itertools import product
  import numpy
  import pytest
  import torch
  from torch import nn
  from alibi_detect.utils.pytorch import GaussianRBF, DeepKernel
label_desc: Use image node_id 4 for calling a global function with example usage: test_deep_kernel(deep_kernel_params) without return types