restore not found的错误

Posted demsg

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了restore not found的错误相关的知识,希望对你有一定的参考价值。

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的错误的主要内容,如果未能解决你的问题,请参考以下文章

window环境下 恢复odoo数据库备份文件时产生的 Database restore error: Command `psql` not found.

Assets file project.assets.json not found. Run a NuGet package restore

vs net core 项目异常解决办法-project.assets.json‘ not found. Run a NuGet package restore to generate this fi

报错“Field pet in XXX.HelloController required a bean of type ‘XXX.Pet‘ that could not be found.“(代码片段

[react] Module not found: Can't resolve 'schedule' in 'C:Usersadcaldvmtn7myapp (代码片段

解决go: go.mod file not found in current directory or any parent directory; see ‘go help modules‘(代码片段