KeyError:"名称'boosted_trees/分位数累加器/'是指不在图形中的操作。 加载保存的模型时



我创建了一个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/'是指 操作不在图中。"

我在做什么错?

我正在使用:Python 3.7Tensorflow 1.13.1

我面临同样的问题。将我的TensorFlow版本更新为TensorFlow 2(恰恰是TF 2.1.0)解决了问题

最新更新