docstr: Pytorch backend for the Gaussian Mixture Model (GMM) outlier detector.
  
  Parameters
  ----------
  n_components
      Number of components in gaussian mixture model.
  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``.
  
  Raises
  ------
  ValueError
      If `n_components` is less than 1.
docstr_tok: ["Pytorch","backend","for","the","Gaussian","Mixture","Model","(","GMM",")","outlier","detector",".","Parameters","--","--","--","--","--","n_components","Number","of","components","in","gaussian","mixture","model",".","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","``",".","Raises","--","--","--","ValueError","If","`","n_components","`","is","less","than","1","."]
code: def __init__(
      self,
      n_components: int,
      device: TorchDeviceType = None,
  ):
      """Pytorch backend for the Gaussian Mixture Model (GMM) outlier detector.
  
      Parameters
      ----------
      n_components
          Number of components in gaussian mixture model.
      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``.
  
      Raises
      ------
      ValueError
          If `n_components` is less than 1.
      """
      super().__init__(device=device)
      if n_components < 1:
          raise ValueError("n_components must be at least 1")
      self.n_components = n_components
  
file_path: alibi-detect/alibi_detect/od/pytorch/gmm.py
imports: from typing import Dict, Type
  from tqdm import tqdm
  import torch
  from torch.utils.data import DataLoader
  from alibi_detect.utils.pytorch.data import TorchDataset
  from alibi_detect.od.pytorch.base import TorchOutlierDetector
  from alibi_detect.models.pytorch.gmm import GMMModel
  from alibi_detect.utils.pytorch.misc import get_optimizer
  from alibi_detect.utils._types import TorchDeviceType
label_desc: Use image node_id 1 to create a new GMMTorch object from inherited base classes: TorchOutlierDetector with example: obj = GMMTorch(n_components, device)