Keras: global name 'Sequential' is not defined(after add 'from keras.models import Sequential, Graph')

Created on 6 Dec 2015  路  2Comments  路  Source: keras-team/keras

I used the next command:
print(type(model))
Then it return: 'keras.models.Sequential'

And I found that in visulize_util.py: if type(model) == Squeential

Is type(model) == Squeential?

or should I add 'from keras.models import Sequential, Graph' in visulize_util.py.

Most helpful comment

I don't get what your problem is. Does

from keras.utils.visualize_util import to_graph
from keras.models import Sequential
to_graph(Sequential())

work for you?

And yes, indeed:

>>> type(Sequential()) == Sequential
True

All 2 comments

I don't get what your problem is. Does

from keras.utils.visualize_util import to_graph
from keras.models import Sequential
to_graph(Sequential())

work for you?

And yes, indeed:

>>> type(Sequential()) == Sequential
True

I am also getting the same issue regarding the "Global name sequential is not defined even i am importing model from keras also I am getting the error. While using the keras model in the code.

model = Sequential()

Was this page helpful?
0 / 5 - 0 ratings