小编Mar*_*ito的帖子

Tensorflow 2.1/Keras - 尝试冻结图形时出现“output_node 不在图形中”错误

我正在尝试保存我使用 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)

python machine-learning python-3.x keras tensorflow

2
推荐指数
1
解决办法
3432
查看次数

标签 统计

keras ×1

machine-learning ×1

python ×1

python-3.x ×1

tensorflow ×1