Tensorflow: checkpoints simple load

2020-04-16 04:31发布

I have a checkpoint file:

checkpoint-20001 checkpoint-20001.meta

how do I extract variables from this space, without having to load the previous model and starting session etc.

I want to do something like

cp = load(checkpoint-20001)
cp.var_a

标签: tensorflow
1条回答
▲ chillily
2楼-- · 2020-04-16 05:03

It's not documented, but you can inspect the contents of a checkpoint from Python using the class tf.train.NewCheckpointReader.

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

Since it isn't a documented class, its API may change in the future.

查看更多
登录 后发表回答