Skip to content

Commit e34afae

Browse files
authored
Merge pull request #1115 from Trusted-AI/development_torch_version_check
Update import version check for suffixes like +cu102
2 parents 00b8bdf + e45f291 commit e34afae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

art/attacks/evasion/adversarial_patch/adversarial_patch_pytorch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ def __init__(
100100
import torch # lgtm [py/repeated-import]
101101
import torchvision
102102

103-
torch_version = list(map(int, torch.__version__.lower().split(".")))
104-
torchvision_version = list(map(int, torchvision.__version__.lower().split(".")))
103+
torch_version = list(map(int, torch.__version__.lower().split("+")[0].split(".")))
104+
torchvision_version = list(map(int, torchvision.__version__.lower().split("+")[0].split(".")))
105105
assert torch_version[0] >= 1 and torch_version[1] >= 7, "AdversarialPatchPyTorch requires torch>=1.7.0"
106106
assert (
107107
torchvision_version[0] >= 0 and torchvision_version[1] >= 8

0 commit comments

Comments
 (0)