docstr: Detect if `x` is an outlier.
  
  Parameters
  ----------
  x
      `torch.Tensor` with leading batch dimension.
  
  Returns
  -------
  `torch.Tensor` of ``bool`` values with leading batch dimension.
  
  Raises
  ------
  ThresholdNotInferredError
      If called before detector has had `infer_threshold` method called.
docstr_tok: ["Detect","if","`","x","`","is","an","outlier",".","Parameters","--","--","--","--","--","x","`","torch.Tensor","`","with","leading","batch","dimension",".","Returns","--","--","--","-","`","torch.Tensor","`","of","``","bool","``","values","with","leading","batch","dimension",".","Raises","--","--","--","ThresholdNotInferredError","If","called","before","detector","has","had","`","infer_threshold","`","method","called","."]
code: def forward(self, x: torch.Tensor) -> torch.Tensor:
      """Detect if `x` is an outlier.
  
      Parameters
      ----------
      x
          `torch.Tensor` with leading batch dimension.
  
      Returns
      -------
      `torch.Tensor` of ``bool`` values with leading batch dimension.
  
      Raises
      ------
      ThresholdNotInferredError
          If called before detector has had `infer_threshold` method called.
      """
      raw_scores = self.score(x)
      scores = self._ensembler(raw_scores)
      if not torch.jit.is_scripting():
          self.check_threshold_inferred()
      preds = scores > self.threshold
      return preds
  
file_path: alibi-detect/alibi_detect/od/pytorch/lof.py
imports: from typing import Optional, Union, List, Tuple
  import numpy
  import torch
  from alibi_detect.od.pytorch.ensemble import Ensembler
  from alibi_detect.od.pytorch.base import TorchOutlierDetector
  from alibi_detect.utils._types import TorchDeviceType
label_desc: Use image node_id 2 for calling the LOFTorch obj's underlying member method code with example usage: obj.forward(x) and returns: preds