Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/393.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Keras 导入错误:无法导入名称';图';_Keras_Keras Layer - Fatal编程技术网

Keras 导入错误:无法导入名称';图';

Keras 导入错误:无法导入名称';图';,keras,keras-layer,Keras,Keras Layer,我在windows上使用Anaconda和python 3.6,我通过以下方式安装了keras: conda install -c conda-forge keras 当我尝试这个代码时 from keras.models import Graph 我收到以下错误消息: ImportError Traceback (most recent call last) <ipython-input-4-74d2d1fd7bad>

我在windows上使用Anaconda和python 3.6,我通过以下方式安装了keras:

conda install -c conda-forge keras
当我尝试这个代码时

from keras.models import Graph
我收到以下错误消息:

ImportError                               Traceback (most recent call last)
<ipython-input-4-74d2d1fd7bad> in <module>()
----> 1 from keras.models import Graph
ImportError: cannot import name 'Graph'
ImportError回溯(最近一次调用)
在()
---->1来自keras.models导入图
ImportError:无法导入名称“Graph”

这不是Python的问题。这是因为keras的最新版本已经从模型中删除了Graph模块。您当然可以查看文档。

如果您查看此Github问题(),您可以使用以下代码行:

from .legacy.models import Graph

但是,建议改用函数式API。请检查图是否已被删除。使用函数式API。此处提供了更新的文档