W3cubDocs

/TensorFlow 2.4

tf.train.list_variables

Lists the checkpoint keys and shapes of variables in a checkpoint.

Checkpoint keys are paths in a checkpoint graph.

Example usage:

import tensorflow as tf
import os
ckpt_directory = "/tmp/training_checkpoints/ckpt"
ckpt = tf.train.Checkpoint(optimizer=optimizer, model=model)
manager = tf.train.CheckpointManager(ckpt, ckpt_directory, max_to_keep=3)
train_and_checkpoint(model, manager)
tf.train.list_variables(manager.latest_checkpoint)
Args
ckpt_dir_or_file Directory with checkpoints file or path to checkpoint.
Returns
List of tuples (key, shape).

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/train/list_variables