Compare version using integers

pytorch version 1.10 has been released and this causes the version check
to erroneously fail. This fixes that comparison.

>>> [1, 10, 0] < [1, 7, 1]
False
>>> ["1", "10", "0"] < ["1", "7", "1"]
True
This commit is contained in:
Matthew Franglen 2021-11-01 22:00:59 +00:00
parent e184f608c5
commit 73228e6c95
1 changed files with 1 additions and 1 deletions

View File

@ -19,7 +19,7 @@ except ImportError:
BICUBIC = Image.BICUBIC
if torch.__version__.split(".") < ["1", "7", "1"]:
if [int(v) for v in torch.__version__.split(".")] < [1, 7, 1]:
warnings.warn("PyTorch version 1.7.1 or higher is recommended")