[英]Error in importing Keras sequential model
I have installed keras followed by tensorflow.我已经安装了 keras,然后是 tensorflow。 When I execute keras sequential model, I get an error message stating that
当我执行 keras 顺序模型时,我收到一条错误消息,指出
from keras.models import sequential
Using TensorFlow backend.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'sequential'
Changing my comment to the answer.将我的评论更改为答案。
Try Sequential
with capital S用大写 S 尝试
Sequential
The problem was the lower case s in
S equential when you imported it.
问题是中的小写
s
S中equential当您导入它。 It should have been - from
keras.models import Sequential
.However, as a side note, you can use the code from tensorflow.keras import Sequential
, using the tensorflow keras api 😊.它应该是 - from
keras.models import Sequential
但是,作为旁注,您可以使用from tensorflow.keras import Sequential
的代码,使用 tensorflow keras api😊。 If you are using colab, you can write %tensorflow_version 2.x
at the beginning of your notebook to use version 2 of tensorflow如果你使用的是 colab,你可以在 notebook 开头写
%tensorflow_version 2.x
来使用 tensorflow 的 version 2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.