Tensorflow:检查点简单加载 [英] Tensorflow: checkpoints simple load
问题描述
我有一个检查点文件:
checkpoint-20001 checkpoint-20001.meta
如何从这个空间中提取变量,而不必加载以前的模型和启动会话等
how do I extract variables from this space, without having to load the previous model and starting session etc.
我想做类似的事情
cp = load(checkpoint-20001)
cp.var_a
推荐答案
它没有记录,但您可以使用类 tf.train.NewCheckpointReader 检查 Python 中检查点的内容.
It's not documented, but you can inspect the contents of a checkpoint from Python using the class tf.train.NewCheckpointReader.
这是一个使用它的测试用例,因此您可以看到该类是如何工作的.https://github.com/tensorflow//blob/861644c0bcae5d56f7b3f439696eefa6df8580ec/tensorflow/python/training/saver_test.py#L1203
Here's a test case that uses it, so you can see how the class works. https://github.com/tensorflow/tensorflow/blob/861644c0bcae5d56f7b3f439696eefa6df8580ec/tensorflow/python/training/saver_test.py#L1203
由于它不是一个文档化的类,它的 API 在未来可能会发生变化.
Since it isn't a documented class, its API may change in the future.
这篇关于Tensorflow:检查点简单加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!