首页 > 解决方案 > 冻结模型中的 KeyError

问题描述

我已经使用 TensorFlow 的graph_util.convert_variables_to_constants功能来冻结ckpt模型。我已将ckpt模型中的所有节点添加到convert_variables_to_constants.

但是,当我想加载冻结的模型并使用它时,显然没有添加一些节点。我的意思是在下面一行:

logits = tf.get_default_graph().get_tensor_by_name("Logits/BiasAdd:0")

它给了我以下错误:

KeyError: "The name 'Logits/BiasAdd:0' refers to a Tensor which does not exist. The operation, 'Logits/BiasAdd', does not exist in the graph."

任何想法如何将此节点添加到冻结模型中?

标签: pythontensorflow

解决方案


推荐阅读