【问题标题】:KeyError: "The name 'boosted_trees/QuantileAccumulator/' refers to an Operation not in the graph." when loading saved modelKeyError:“名称 'boosted_trees/QuantileAccumulator/' 指的是不在图中的操作。”加载保存的模型时
【发布时间】:2019-07-25 18:15:24
【问题描述】:

我创建了一个 TensorFlow 估算器:

outlier_estimator = tf.estimator.BoostedTreesClassifier(
    n_batches_per_layer = 15,
    feature_columns=outlier_feature_columns, 
    model_dir="./tensorboard_logs/wifi_outliers/", 
    n_classes=2
)

并保存:

def serving_input_receiver_fn():
    inputs = {
        "signal_0": tf.placeholder(shape=[1], dtype=tf.float32, name="signal_0"),
        "signal_1": tf.placeholder(shape=[1], dtype=tf.float32, name="signal_1")
    }
    return tf.estimator.export.ServingInputReceiver(inputs, inputs)

outlier_estimator.export_savedmodel(export_dir_base="./export/", serving_input_receiver_fn=serving_input_receiver_fn)

但是当我尝试加载保存的模型时

tf.reset_default_graph()
with tf.Session() as sess:
    tf.saved_model.loader.load(
        sess,
        [tf.saved_model.tag_constants.SERVING],
        "./export/1551699998"
    )

我遇到了一个错误:

KeyError:“名称 'boosted_trees/QuantileAccumulator/' 指的是 图中没有的操作。”

我做错了什么?

我正在使用: 蟒蛇 3.7 张量流 1.13.1

【问题讨论】:

  • 嗨,我遇到了完全相同的问题,有什么线索吗?
  • @benjamin 你好!这个问题没有任何解决办法,抱歉。
  • 观察一下,如果将模型从 BoostedTree 更改为朴素的线性模型,导出完全没有问题。所以这个问题可能是由提升树模型在图中的建模方式引起的。

标签: tensorflow tensorflow-estimator


【解决方案1】:

我遇到了同样的问题。将我的 Tensorflow 版本更新到 Tensorflow 2(确切地说是 tf 2.1.0)解决了这个问题

【讨论】:

    猜你喜欢
    • 2018-12-27
    • 2018-05-03
    • 1970-01-01
    • 2016-10-27
    • 2018-08-28
    • 2020-05-14
    • 2018-03-01
    • 2019-09-11
    • 1970-01-01
    相关资源
    最近更新 更多