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

Bug: "from keras import initializations" is outdated #10

Open
rcasero opened this issue Jun 19, 2017 · 2 comments
Open

Bug: "from keras import initializations" is outdated #10

rcasero opened this issue Jun 19, 2017 · 2 comments

Comments

@rcasero
Copy link

rcasero commented Jun 19, 2017

The line

from keras import initializations as initializations

in keras_version/cnn_functions.py produces the error

ImportError: cannot import name initializations

in recent versions of keras (e.g. 2.0.2), as reported here.

@rcasero
Copy link
Author

rcasero commented Jun 19, 2017

Solution for the import that doesn't interfere with current code proposed here

https://github.com/rcasero/DeepCell/commit/d91d2da0ea4ee40e97c2d09981cef57587842b24

following the idea in https://stackoverflow.com/questions/3496592/conditional-import-of-modules-in-python

(More in the code needs to be modified, wherever initializations is called).

@rcasero
Copy link
Author

rcasero commented Jun 23, 2017

Actually, a better way would be

if (parse_version(keras_version) < parse_version('2.0.0')):
    from keras import initializations as initializations
else:
    from keras import initializers as initializers

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