【发布时间】:2017-08-07 00:15:06
【问题描述】:
我正在尝试使用 Keras 重现实体嵌入模型。这是github link 并使用kaggle 分支。有一个python文件models.py,使用Merge层。
from keras.layers.core import Dense, Dropout, Activation, Merge, Reshape
......
self.model.add(Merge(models, mode='concat'))
这段代码对于旧版本的Keras应该没问题,但是使用Keras 2.0.0 使用tensorflow 1.0.0作为后端(python 2.7),会出现错误信息:
Using TensorFlow backend.
Traceback (most recent call last):
File "/Users/pengjuzhao/Udacity/MLND/entity-embedding-rossmann/test_model.py", line 2, in <module>
from models import NN_with_EntityEmbedding
File "/Users/pengjuzhao/Udacity/MLND/entity-embedding-rossmann/models.py", line 8, in <module>
from keras.layers.core import Dense, Dropout, Activation, Merge, Reshape
ImportError: cannot import name Merge
[Finished in 1.8s with exit code 1]
[shell_cmd: python -u "/Users/pengjuzhao/Udacity/MLND/entity-embedding-rossmann/test_model.py"]
[dir: /Users/pengjuzhao/Udacity/MLND/entity-embedding-rossmann]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
有没有人知道如何达到相同的目标(self.model.add(Merge(models, mode='concat')))或如何使用 Keras 2.0.0 使用合并/合并层?
先感谢您。
【问题讨论】:
标签: python tensorflow deep-learning keras