查看检查点文件的内容?

See the contents of Checkpoint files?

根据 documentation,会话中的变量可以保存和恢复 to/from 带有 tf.train.Saver 对象的二进制文件。

但是有什么办法可以看到二进制文件的内容吗?

这些文件 read/written 在 C++ 中使用 TensorSliceReader and TensorSliceWriter,使用似乎是张量数据的特殊格式。

这些文件包含保存的张量的值。检查这些值的最简单方法是从检查点文件中恢复张量并直接检查张量。

检查点文件是一个 sstable。每条记录的值是序列化的 SavedTensorSlices 消息。 (资源 here

要查看序列化 SavedTensorSlices 消息的内容,我们只需将内容反序列化为 SavedTensorSlices 对象。如下所示:

SavedTensorSlices message;
message.ParseFromString(value);
cout << message.DebugString();