code: def test_knn_infer_threshold_value_errors():
      """Tests the correct errors are raised when using incorrect choice of fpr for the KNNTorch backend detector."""
      knn_torch = KNNTorch(k=4)
      x = torch.randn((1024, 10))
      knn_torch.fit(x)
  
      # fpr must be greater than 1/len(x) otherwise it excludes all points in the reference dataset
      with pytest.raises(ValueError) as err:
          knn_torch.infer_threshold(x, 1 / 1025)
      assert (
          str(err.value)
          == "`fpr` must be greater than `1/len(x)=0.0009765625`."
      )
  
      # fpr must be between 0 and 1
      with pytest.raises(ValueError) as err:
          knn_torch.infer_threshold(x, 1.1)
      assert str(err.value) == "`fpr` must be in `(0, 1)`."
  
      knn_torch.infer_threshold(x, 0.99)
      knn_torch.infer_threshold(x, 1 / 1023)
  
file_path: alibi-detect/alibi_detect/od/tests/test__knn/test__knn_backend.py
imports: import pytest
  import torch
  from alibi_detect.od.pytorch.knn import KNNTorch
  from alibi_detect.utils.pytorch.kernels import GaussianRBF
  from alibi_detect.od.pytorch.ensemble import Ensembler, PValNormalizer, AverageAggregator
  from alibi_detect.exceptions import NotFittedError, ThresholdNotInferredError
label_desc: Use image node_id 10 for calling a global function with example usage: test_knn_infer_threshold_value_errors() without return types