docstr: Kernel variant of the PyTorch backend for PCA detector.
  
  Parameters
  ----------
  n_components:
      The number of dimensions in the principal subspace.
  kernel
      Kernel function to use for outlier detection.
  device
      Device type used. The default tries to use the GPU and falls back on CPU if needed.
      Can be specified by passing either ``'cuda'``, ``'gpu'``, ``'cpu'`` or an instance of
      ``torch.device``.
docstr_tok: ["Kernel","variant","of","the","PyTorch","backend","for","PCA","detector",".","Parameters","--","--","--","--","--","n_components",":","The","number","of","dimensions","in","the","principal","subspace",".","kernel","Kernel","function","to","use","for","outlier","detection",".","device","Device","type","used",".","The","default","tries","to","use","the","GPU","and","falls","back","on","CPU","if","needed",".","Can","be","specified","by","passing","either","``","'cuda","'","``",",","``","'gpu","'","``",",","``","'cpu","'","``","or","an","instance","of","``","torch.device","``","."]
code: def __init__(
      self,
      n_components: int,
      kernel: Optional[Callable],
      device: TorchDeviceType = None,
  ):
      """Kernel variant of the PyTorch backend for PCA detector.
  
      Parameters
      ----------
      n_components:
          The number of dimensions in the principal subspace.
      kernel
          Kernel function to use for outlier detection.
      device
          Device type used. The default tries to use the GPU and falls back on CPU if needed.
          Can be specified by passing either ``'cuda'``, ``'gpu'``, ``'cpu'`` or an instance of
          ``torch.device``.
      """
      super().__init__(device=device, n_components=n_components)
      self.kernel = kernel
  
imports: from typing import Optional, Callable
  import torch
  from alibi_detect.od.pytorch.base import TorchOutlierDetector
  from alibi_detect.utils._types import TorchDeviceType
label_desc: Use image node_id 1 to create a new KernelPCATorch object from inherited base classes: PCATorch with example: obj = KernelPCATorch(n_components, kernel, device)