Alexander R Johansen
Alexander R Johansen

Reputation: 2817

Tensorflow: checkpoints simple load

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

Upvotes: 2

Views: 754

Answers (1)

Peter Hawkins
Peter Hawkins

Reputation: 3211

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.

Upvotes: 1

Related Questions