Pretty Ninà
Pretty Ninà

Reputation: 31

ImportError: cannot import name 'Graph'

I am on windows using Anaconda with python 3.6, I have installed keras by:

conda install -c conda-forge keras

and whene i try this code

from keras.models import Graph

I get this error message:

ImportError                               Traceback (most recent call last)
<ipython-input-4-74d2d1fd7bad> in <module>()
----> 1 from keras.models import Graph
ImportError: cannot import name 'Graph'

Upvotes: 2

Views: 6312

Answers (2)

Koorosh Aslansefat
Koorosh Aslansefat

Reputation: 52

If you check this Github issue (Why Keras remove graph model?), you can use the following line of code:

from .legacy.models import Graph

However, it is suggested to use functional API instead. Please check The Functional API

Upvotes: 1

Nisarg Bhatt
Nisarg Bhatt

Reputation: 389

This is not a Python issue. This is because the latest version of keras has removed Graph module from models. You can surely check the documentation.

Upvotes: 2

Related Questions