码迷,mamicode.com
首页 > 其他好文 > 详细

restore not found的错误

时间:2017-09-06 16:21:04      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:ble   port   流程   over   get   nbsp   建图   mod   测试   

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的错误

标签:ble   port   流程   over   get   nbsp   建图   mod   测试   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!