Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug in Tensorflow version check #28

Open
addadda023 opened this issue Aug 7, 2020 · 0 comments
Open

Possible bug in Tensorflow version check #28

addadda023 opened this issue Aug 7, 2020 · 0 comments

Comments

@addadda023
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant