How do I list certain variables in the checkpoint?
You can view the saved variables in .ckpt file using,
import tensorflow as tf
variables_in_checkpoint = tf.train.list_variables('path.ckpt')
print("Variables found in checkpoint file",variables_in_checkpoint)
There's list_variables
method in checkpoint_utils.py which lets you see all saved variables.
However, for your use-case, it may be easier to restore with a Saver
. If you know the names of the variables when you saved the checkpoint, you can create a new saver, and tell it to initialize those names into new Variable
objects (possibly with different names). This is used in CIFAR example to select a restore a subset of variables. See Choosing which Variables to Save and Restore in the Howto