code: def test_pca_linear_torch_backend_ts(tmp_path):
      """Test Linear PCA detector backend is torch-scriptable and savable."""
      pca_torch = LinearPCATorch(n_components=5)
      x = torch.randn((3, 10)) * torch.tensor([[1], [1], [100]])
      x_ref = torch.randn((1024, 10))
      pca_torch.fit(x_ref)
      pca_torch.infer_threshold(x_ref, 0.1)
      pred_1 = pca_torch(x)
  
      pca_torch = torch.jit.script(pca_torch)
      pred_2 = pca_torch(x)
      assert torch.all(pred_1 == pred_2)
  
      pca_torch.save(tmp_path / "pca_torch.pt")
      pca_torch = torch.load(tmp_path / "pca_torch.pt")
      pred_2 = pca_torch(x)
      assert torch.all(pred_1 == pred_2)
  
file_path: alibi-detect/alibi_detect/od/tests/test__pca/test__pca_backend.py
imports: import pytest
  import torch
  import numpy
  from alibi_detect.utils.pytorch.kernels import GaussianRBF
  from alibi_detect.od.pytorch.pca import LinearPCATorch, KernelPCATorch
  from alibi_detect.exceptions import NotFittedError, ThresholdNotInferredError
label_desc: Use image node_id 3 for calling a global function with example usage: test_pca_linear_torch_backend_ts(tmp_path) without return types