我正在尝试保存我使用 Keras 创建并另存为 .h5 文件的模型,但每次尝试运行 freeze_session 函数时都会收到此错误消息:output_node/Identity is not in graph
这是我的代码(我使用的是 Tensorflow 2.1.0):
def freeze_session(session, keep_var_names=None, output_names=None, clear_devices=True):
"""
Freezes the state of a session into a pruned computation graph.
Creates a new computation graph where variable nodes are replaced by
constants taking their current value in the session. The new graph will be
pruned so subgraphs that are not necessary to compute the requested
outputs are removed.
@param session The TensorFlow session to be frozen.
@param keep_var_names …
Run Code Online (Sandbox Code Playgroud)