我正在尝试修改代码:https://github.com/sujitpal/dl-models-for-qa/blob/master/src/qa-lstm-story.py是在Keras 1.x中为Keras 2.2.4实现的,特别是关于现已弃用的Merge函数(例如,参见第90行)。
在第90行中,我将facts.add(Merge([senc, qenc], mode="dot", dot_axes=[2, 2]))
替换为facts.add(Dot(axes=[2,2])([senc, qenc]))
,但这不起作用。
出现以下错误:
Traceback (most recent call last):
File "qa-blstm-story-new.py", line 90, in <module>
facts.add(Dot(axes=[2,2])([senc, qenc]))
File "/home/dsouzaj/dl-models-for-qa/venv/lib/python3.7/site-packages/keras/engine/base_layer.py", line 414, in __call__
self.assert_input_compatibility(inputs)
File "/home/dsouzaj/dl-models-for-qa/venv/lib/python3.7/site-packages/keras/engine/base_layer.py", line 285, in assert_input_compatibility
str(inputs) + '. All inputs to the layer '
ValueError: Layer dot_1 was called with an input that isn't a symbolic tensor. Received type: <class 'keras.engine.sequential.Sequential'>. Full input: [<keras.engine.sequential.Sequential object at 0x7ff91afec780>, <keras.engine.sequential.Sequential object at 0x7ff7e2559d68>]. All inputs to the layer should be tensors.
应如何正确进行?谢谢!