code: def test_gmm_torchscript(tmp_path):
      """Tests user can torch-script gmm detector."""
      gmm_detector = GMM(n_components=8, backend="pytorch")
      X_ref, _ = make_moons(
          1001, shuffle=True, noise=0.05, random_state=None
      )
      X_ref, x_inlier = X_ref[0:1000], X_ref[1000][None]
      gmm_detector.fit(X_ref)
      gmm_detector.infer_threshold(X_ref, 0.1)
      x_outlier = np.array([[-1, 1.5]])
      x = torch.tensor([x_inlier[0], x_outlier[0]], dtype=torch.float32)
  
      ts_gmm = torch.jit.script(gmm_detector.backend)
      y = ts_gmm(x)
      assert torch.all(y == torch.tensor([False, True]))
  
      ts_gmm.save(tmp_path / "gmm.pt")
      ts_gmm = torch.load(tmp_path / "gmm.pt")
      y = ts_gmm(x)
      assert torch.all(y == torch.tensor([False, True]))
  
file_path: alibi-detect/alibi_detect/od/tests/test__gmm/test__gmm.py
imports: import pytest
  import numpy
  import torch
  from alibi_detect.od._gmm import GMM
  from alibi_detect.exceptions import NotFittedError
  from sklearn.datasets import make_moons
label_desc: Use image node_id 5 for calling a global function with example usage: test_gmm_torchscript(tmp_path) without return types