Torchvision version number will not be recognized correctly when it is greater than 0.10.0 in util/misc.py.
Cause
torchvision.__version__ provides torchvision version number in string format of major.minor.patch (e.g. 0.5.0 or 0.11.1).
float(torchvision.__version__[:3]) can get the correct major.minor version number when the minor value is less than 10 (e.g. can get "0.5" from "0.5.0").
But when the version is 0.11.1 it will get 0.1, which is incorrect and will import old deprecated ops. Even when you get the correct version number 0.11, the float number 0.11 is still less than 0.5 if you compare them by values.
Solution
In order to prevent this issue and work with future versions, we have to compare the major number first, then the minor number, etc.
Issue Description
Torchvision version number will not be recognized correctly when it is greater than
0.10.0
inutil/misc.py
.Cause
torchvision.__version__
provides torchvision version number in string format ofmajor.minor.patch
(e.g. 0.5.0 or 0.11.1).float(torchvision.__version__[:3])
can get the correctmajor.minor
version number when the minor value is less than 10 (e.g. can get "0.5" from "0.5.0"). But when the version is0.11.1
it will get0.1
, which is incorrect and will import old deprecated ops. Even when you get the correct version number0.11
, the float number0.11
is still less than0.5
if you compare them by values.Solution
In order to prevent this issue and work with future versions, we have to compare the major number first, then the minor number, etc.