diff --git a/alibi_detect/od/pytorch/knn.py b/alibi_detect/od/pytorch/knn.py index cce26a749..6171a594e 100644 --- a/alibi_detect/od/pytorch/knn.py +++ b/alibi_detect/od/pytorch/knn.py @@ -42,7 +42,6 @@ def __init__( self.ks = torch.tensor(k) if self.ensemble else torch.tensor([k], device=self.device) self.ensembler = ensembler - @torch.no_grad() def forward(self, x: torch.Tensor) -> torch.Tensor: """Detect if `x` is an outlier. @@ -67,7 +66,6 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: preds = scores > self.threshold return preds - @torch.no_grad() def score(self, x: torch.Tensor) -> torch.Tensor: """Computes the score of `x` diff --git a/alibi_detect/od/pytorch/mahalanobis.py b/alibi_detect/od/pytorch/mahalanobis.py index bcd17af26..7754f008c 100644 --- a/alibi_detect/od/pytorch/mahalanobis.py +++ b/alibi_detect/od/pytorch/mahalanobis.py @@ -26,7 +26,6 @@ def __init__( super().__init__(device=device) self.min_eigenvalue = min_eigenvalue - @torch.no_grad() def forward(self, x: torch.Tensor) -> torch.Tensor: """Detect if `x` is an outlier. @@ -50,7 +49,6 @@ def forward(self, x: torch.Tensor) -> torch.Tensor: preds = scores > self.threshold return preds - @torch.no_grad() def score(self, x: torch.Tensor) -> torch.Tensor: """Computes the score of `x` diff --git a/setup.py b/setup.py index 317665771..14558bf01 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def readme(): "prophet>=1.1.0, <2.0.0", ], "torch": [ - "torch>=1.7.0, <1.14.0" + "torch>=1.7.0, <3.0.0" ], # https://github.com/SeldonIO/alibi-detect/issues/375 and 387 "tensorflow": [ @@ -23,14 +23,14 @@ def readme(): ], "keops": [ "pykeops>=2.0.0, <2.2.0", - "torch>=1.7.0, <1.14.0" + "torch>=1.7.0, <3.0.0" ], "all": [ "prophet>=1.1.0, <2.0.0", "tensorflow_probability>=0.8.0, <0.20.0", "tensorflow>=2.2.0, !=2.6.0, !=2.6.1, <2.13.0", # https://github.com/SeldonIO/alibi-detect/issues/375 and 387 "pykeops>=2.0.0, <2.2.0", - "torch>=1.7.0, <1.14.0" + "torch>=1.7.0, <3.0.0" ], }