docstr: Score `x` instances using the detector.
  
  Computes the k nearest neighbor distance/kernel similarity for each instance in `x`. If `k` is a single
  value then this is the score otherwise if `k` is an array of values then the score is aggregated using
  the ensembler.
  
  Parameters
  ----------
  x
      Data to score. The shape of `x` should be `(n_instances, n_features)`.
  
  Returns
  -------
  Outlier scores. The shape of the scores is `(n_instances,)`. The higher the score, the more anomalous the         instance.
  
  Raises
  ------
  NotFittedError
      If called before detector has been fit.
  ThresholdNotInferredError
      If k is a list and a threshold was not inferred.
docstr_tok: ["Score","`","x","`","instances","using","the","detector",".","Computes","the","k","nearest","neighbor","distance\/kernel","similarity","for","each","instance","in","`","x","`",".","If","`","k","`","is","a","single","value","then","this","is","the","score","otherwise","if","`","k","`","is","an","array","of","values","then","the","score","is","aggregated","using","the","ensembler",".","Parameters","--","--","--","--","--","x","Data","to","score",".","The","shape","of","`","x","`","should","be","`","(","n_instances",",","n_features",")","`",".","Returns","--","--","--","-","Outlier","scores",".","The","shape","of","the","scores","is","`","(","n_instances",",",")","`",".","The","higher","the","score",",","the","more","anomalous","the","instance",".","Raises","--","--","--","NotFittedError","If","called","before","detector","has","been","fit",".","ThresholdNotInferredError","If","k","is","a","list","and","a","threshold","was","not","inferred","."]
code: def score(self, x: np.ndarray) -> np.ndarray:
      """Score `x` instances using the detector.
  
          Computes the k nearest neighbor distance/kernel similarity for each instance in `x`. If `k` is a single
          value then this is the score otherwise if `k` is an array of values then the score is aggregated using
          the ensembler.
  
          Parameters
          ----------
          x
              Data to score. The shape of `x` should be `(n_instances, n_features)`.
  
          Returns
          -------
          Outlier scores. The shape of the scores is `(n_instances,)`. The higher the score, the more anomalous the \
          instance.
  
          Raises
          ------
          NotFittedError
              If called before detector has been fit.
          ThresholdNotInferredError
              If k is a list and a threshold was not inferred.
          """
      score = self.backend.score(self.backend._to_backend_dtype(x))
      score = self.backend._ensembler(score)
      return self.backend._to_frontend_dtype(score)
  
imports: from typing import Callable, Union, Optional, Dict, Any, List, Tuple
  from typing_extensions import Literal
  import numpy
  from alibi_detect.base import outlier_prediction_dict
  from alibi_detect.exceptions import _catch_error
  from alibi_detect.od.base import TransformProtocol, TransformProtocolType
  from alibi_detect.base import BaseDetector, FitMixin, ThresholdMixin
  from alibi_detect.od.pytorch import KNNTorch, Ensembler
  from alibi_detect.od.base import get_aggregator, get_normalizer, NormalizerLiterals, AggregatorLiterals
  from alibi_detect.utils.frameworks import BackendValidator
  from alibi_detect.version import __version__
  from alibi_detect.utils._types import TorchDeviceType
label_desc: Use image node_id 3 for calling the KNN obj's underlying member method code with example usage: obj.score(x) and returns: self