gpt4 book ai didi

tensorflow - key 错误 : "The name ' boosted_trees/QuantileAccumulator/' refers to an Operation not in the graph." when loading saved model

转载 作者:行者123 更新时间:2023-12-03 08:29:54 25 4
gpt4 key购买 nike

我创建了一个 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: "The name 'boosted_trees/QuantileAccumulator/' refers to an Operation not in the graph."



我究竟做错了什么?

我正在使用:
python 3.7
tensorflow 1.13.1

最佳答案

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

关于tensorflow - key 错误 : "The name ' boosted_trees/QuantileAccumulator/' refers to an Operation not in the graph." when loading saved model,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54983160/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com