没有名为'keras.layers.core'的模块
from keras.models import Sequential
from keras.layers.core import Dense, Flatten
from keras.layers.convolutional import Conv2D, MaxPooling2D
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-35-e0ce7722f83a> in <cell line: 2>()
1 from keras.models import Sequential
----> 2 from keras.layers.core import Dense, Flatten
3 from keras.layers.convolutional import Conv2D, MaxPooling2D
ModuleNotFoundError: No module named 'keras.layers.core'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
使用Chat GPT,答案是:
这个错误提示说找不到模块 keras.layers.core,这可能是 Keras 安装有问题或者不兼容。
截至我最后更新时的 Keras 版本 2.7.0(这是最新的稳定版本),模块的结构发生了变化,keras.layers.core 不再使用了。现在,像 Dense 和 Flatten 这样的核心层可以直接在 keras.layers 下找到。
0 个回答
暂无回答