Created
May 7, 2021 17:05
-
-
Save thepurpleowl/c37c8d32fc51d962fa33729e379fbb67 to your computer and use it in GitHub Desktop.
To check tf.Variable shape, value, type etc in the saved checkpoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
from tensorflow.python.tools.inspect_checkpoint import print_tensors_in_checkpoint_file | |
import re | |
latest_ckp = tf.train.latest_checkpoint('./training_checkpoints') | |
print_tensors_in_checkpoint_file(latest_ckp, all_tensors=True, tensor_name='') | |
# to check specific variable in checkpoint | |
# [print(var.variables) for var in tf.train.list_variables(latest_ckp) if re.match(r'.*decoder/embedding/embeddings/.ATTRIBUTES/.*',var[0])] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment