code: def test_svm_device_warnings(optimization, device):
      """Test SVM detector device warnings."""
  
      warning_msgs = {
          "sgd": (
              "If using the `sgd` optimization option with GPU then only the Nystroem approximation"
              " portion of the method will utilize the GPU. Consider using the `bgd` option which will"
              " run everything on the GPU."
          ),
          "bgd": (
              "The `bgd` optimization option is best suited for GPU. "
              "If you want to use CPU, consider using the `sgd` option."
          ),
      }
  
      with pytest.warns(UserWarning) as warning:
          _ = SVM(
              n_components=10,
              backend="pytorch",
              kernel=GaussianRBF(torch.tensor(2)),
              optimization=optimization,
              device=device,
              nu=0.1,
          )
  
      assert len(warning) == 1
      assert str(warning[0].message) == warning_msgs[optimization]
  
file_path: alibi-detect/alibi_detect/od/tests/test__svm/test__svm.py
imports: import pytest
  import numpy
  import torch
  from alibi_detect.od._svm import SVM
  from alibi_detect.exceptions import NotFittedError
  from alibi_detect.utils.pytorch import GaussianRBF
  from sklearn.datasets import make_moons
label_desc: Use image node_id 2 for calling a global function with example usage: test_svm_device_warnings(optimization, device) without return types