Skip to content

Possible bug in Tensorflow version check #28

@addadda023

Description

@addadda023

Hi, utils.misc_utils.check_tensorflow_version() results in an error if one uses say version 1.15. See the version history here.

def check_tensorflow_version():
    if tf.__version__ < "1.2.1":
        raise EnvironmentError("Tensorflow version must >= 1.2.1")

image

The code can be updated to:

def check_tensorflow_version():

    def compare_version(version1, version2):

        nums1 = version1.split('.')
        nums2 = version2.split('.')
        n1, n2 = len(nums1), len(nums2)

        # compare versions
        for i in range(max(n1, n2)):
            i1 = int(nums1[i]) if i < n1 else 0
            i2 = int(nums2[i]) if i < n2 else 0
            if i1 != i2:
                return True if i1 > i2 else False

        # the versions are equal
        return False

    if not compare_version(tf.__version__, "1.2.1"):
        raise EnvironmentError("Tensorflow version must >= 1.2.1")

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions