tf.train.list_variables  |  TensorFlow v2.16.1 (original) (raw)

tf.train.list_variables

Stay organized with collections Save and categorize content based on your preferences.

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

View aliases

Compat aliases for migration

SeeMigration guide for more details.

tf.compat.v1.train.list_variables

tf.train.list_variables(
    ckpt_dir_or_file
)

Used in the notebooks

Used in the guide Used in the tutorials
Introduction to modules, layers, and models TensorFlow 2 TPUEmbeddingLayer: Quick Start

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).

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.

Last updated 2024-04-26 UTC.