Skip to content

pytorch version comparison code fails for pytorch 1.10 #169

@matthewfranglen

Description

@matthewfranglen

A warning is produced when running clip using pytorch version 1.10 or greater.

The version check code performs a comparison using strings. This fails for version 1.10 because string comparison is left to right and 1 is less than 7.

>>> ["1", "10", "0"] < ["1", "7", "1"]
True
>>> ["1", "9", "0"] < ["1", "7", "1"]
False

There is the TorchVersion class that would make this comparison easier to perform however that does not exist in pytorch 1.7. I suggest converting the strings into integers before performing the comparison.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions