首页 > 其他 > 详细

restore not found的错误

时间:2017-09-06 16:12:23      阅读:406      评论:0      收藏:0      [点我收藏+]

tensorflow保存模型后,restore的时候报参数not found是什么原因呢

一般预测的流程是:建图然后restore参数,很有可能你的变量作用域和train的时候不一样,那么在现在的变量域很可能找不到变量。

总而言之就是,保证和建图的变量域是一致的,再restore

如何查看原来的变量域呢:

from tensorflow.python.tools.inspect_checkpoint import print_tensors_in_checkpoint_file

print_tensors_in_checkpoint_file(file_name=‘../model/model_396300.ckpt‘, tensor_name=‘‘,all_tensors=‘‘)

 

或者这种(未测试)

from tensorflow.python import pywrap_tensorflow
reader = pywrap_tensorflow.NewCheckpointReader(‘./model.ckpt‘)
var_to_shape_map = reader.get_variable_to_shape_map()
for key in var_to_shape_map:
    print("tensor_name: ", key)
    print(reader.get_tensor(key))

https://stackoverflow.com/questions/40719311/list-of-restored-variables-in-tensorflow

restore not found的错误

原文:http://www.cnblogs.com/dmesg/p/7485342.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!