docstr: Compute and return full kernel matrix between arrays x and y. 
docstr_tok: ["Compute","and","return","full","kernel","matrix","between","arrays","x","and","y","."]
code: def kernel_matrix(
      self, x: torch.Tensor, y: torch.Tensor
  ) -> torch.Tensor:
      """Compute and return full kernel matrix between arrays x and y."""
      k_xy = self.kernel(x, y, self.infer_sigma)
      k_xx = (
          self.k_xx
          if self.k_xx is not None and self.update_x_ref is None
          else self.kernel(x, x)
      )
      k_yy = self.kernel(y, y)
      kernel_mat = torch.cat(
          [torch.cat([k_xx, k_xy], 1), torch.cat([k_xy.T, k_yy], 1)], 0
      )
      return kernel_mat
  
file_path: alibi-detect/alibi_detect/cd/pytorch/mmd.py
imports: import logging
  import numpy
  import torch
  from typing import Callable, Dict, Optional, Tuple, Union
  from alibi_detect.cd.base import BaseMMDDrift
  from alibi_detect.utils.pytorch import get_device
  from alibi_detect.utils.pytorch.distance import mmd2_from_kernel_matrix
  from alibi_detect.utils.pytorch.kernels import GaussianRBF
  from alibi_detect.utils.warnings import deprecated_alias
  from alibi_detect.utils.frameworks import Framework
  from alibi_detect.utils._types import TorchDeviceType
label_desc: Use image node_id 2 for calling the MMDDriftTorch obj's underlying member method code with example usage: obj.kernel_matrix(x, y) and returns: kernel_mat