【发布时间】:2016-04-20 13:45:15
【问题描述】:
我目前正在尝试可视化 Keras 1.0 中的中间层的输出(我可以使用 Keras 0.3 完成),但它不再起作用了。
x = model.input
y = model.layers[3].output
f = theano.function([x], y)
但我收到以下错误:
MissingInputError: ("An input of the graph, used to compute DimShuffle{x,x,x,x}(keras_learning_phase), was not provided and not given a value.Use the Theano flag exception_verbosity='high',for more information on this error.", keras_learning_phase)
在 Keras 1.0 之前,使用我的图模型,我可以这样做:
x = graph.inputs['input'].input
y = graph.nodes[layer].get_output(train=False)
f = theano.function([x], y, allow_input_downcast=True)
所以我怀疑它来自我不知道如何在新版本中设置的“train=False”参数。
感谢您的帮助
【问题讨论】:
-
请注意,Keras 1.0 不再支持图形模型。使用 Merge 选项扩展了顺序模型,并用功能 API 替换了 Graph 模型。我建议您仔细阅读:keras.io/getting-started/functional-api-guide 以获取更多信息。