TensorFlow 提供了# inpect_checkpoint.py
"""
A simple script for inspect checkpoint files.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import tensorflow as tf
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_string("file_name", "", "Checkpoint filename")
tf.app.flags.DEFINE_string("tensor_name", "",
"Name of the tensor to inspect")
def print_tensors_in_checkpoint_file(file_name, tensor_name):
"""
打印 checkpoint 文件中的 tensors.
如果未指定 `tensor_name`,则打印 checkpoint 文件中的 tensor names 和 shapes.
如果指定了 `tensor_name`,则打印该 tensor 的内容.
Args:
file_name: Name of the checkpoint file.
tensor_name: Name o