# tf.train.list_variables

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.7.4/tensorflow/python/training/checkpoint_utils.py#L89-L119) |

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

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.train.list_variables`](https://www.tensorflow.org/api_docs/python/tf/train/list_variables)

<br />

    tf.train.list_variables(
        ckpt_dir_or_file
    )

Checkpoint keys are paths in a checkpoint graph.

<br />

| ## Example usage ||
|---|---|
| <br /> </td> </tr> </table> 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) <br /> <br /> <br /> | ## Args || |---|---| | `ckpt_dir_or_file` | Directory with checkpoints file or path to checkpoint. | <br /> <br /> <br /> <br /> | ## Returns || |---|---| | List of tuples `(key, shape)`. || <br /> ||