Tensorflow使用记录,API使用报错处理

来源:互联网 发布:淘宝义卖作文 编辑:程序博客网 时间:2024/05/16 10:17

1.Cannot interpret feed_dict key as Tensor: The name ‘x’ refers to an operation,
not a Tensor. Tensor names must be of the form “:”.
sess.run(y, {tf.get_default_graph().get_operation_by_name(‘x’).outputs[0]: [1, 2, 3]})
x 后面需要加上0,tf.get_default_graph().get_operation_by_name(‘x:0’).
详见
http://blog.csdn.net/ztf312/article/details/72859075
http://stackoverflow.com/a/37870634/419116

2.WARNING:tensorflow:From export_session_bundle.py:17: classification_signature (from tensorflow.contrib.session_bundle.exporter) is deprecated and will be removed after 2017-06-30.
之前的通过tensorflow.contrib.session_bundle.exporter导出sessionbundle的方式已经废弃。

     saver.restore(sess, cktpath)     #saver.restore(sess, "save/model.ckpt")     # 通过张量的名称来获取张量     model_exporter = exporter.Exporter(saver)     #signature = exporter.classification_signature(input_tensor=external_x, classes_tensor=classes, scores_tensor=scores)     signature = exporter.classification_signature(input_tensor=tf.get_default_graph().get_tensor_by_name("input_x:0"), classes_tensor=tf.get_default_graph().get_tensor_by_name("input_y:0"))     model_exporter.init(sess.graph.as_graph_def(),default_graph_signature=signature, init_op=tf.initialize_all_tables())     model_exporter.export("./export", tf.constant(time.time()), sess)

改用新的方式SavedModel保存sessionBundle。
https://github.com/tensorflow/tensorflow/blob/a304537954a865752ad1b18461e6bd67b36082db/tensorflow/python/saved_model/README.md
http://blog.csdn.net/thriving_fcl/article/details/75213361
关于Tensorflow保存和恢复模型的两种方式,区别在于是否需要再定义图结构。
http://blog.csdn.net/thriving_fcl/article/details/71423039
http://blog.csdn.net/marsjhao/article/details/72829635

原创粉丝点击