【发布时间】:2020-11-21 15:51:46
【问题描述】:
这就是我保存模型的方式。
# First created serving_input func
serving_input_fn = tf.estimator.export.build_parsing_serving_input_receiver_fn(tf.feature_column.make_parse_example_spec(my_feature_columns))
# Save Estimator as a tf model
classifier.export_saved_model("location", serving_input_fn)
这产生了一个文件夹,其中包含“saved_model.pb”文件和一个文件夹“variable”
问题是我尝试加载和运行模型
imported_model = tf.saved_model.load("/folderLocation")
imported_model_res = imported_model.evaluate(input_fn=lambda: input_fn(x_test, y_test, training=False))
但我收到一个错误提示
AttributeError: 'AutoTrackable' 对象没有属性 'evaluate'
非常感谢任何帮助。谢谢
【问题讨论】:
标签: python tensorflow machine-learning tensorflow2.0