TensorFlow 中的 Saver 有跨平台的文件格式吗?
Does the Saver in TensorFlow have a cross-platform file format?
假设我在对一些 tf.Session
sess
和一些 tf.train.Saver
saver
进行一些计算后在机器 A 上执行以下命令,假设我有一些 tf.Graph
G
带有一些变量 V
:
with tf.Graph().as_default():
# Define G, V, initialize for sess, then run some computation
saver.save(sess, '/A/somefolder/somefile')
这将创建 somefile
、somefile.meta
,并在 somefolder
中更新 checkpoints
。
接下来,假设我在机器 B 上复制 somefolder
和 运行 的全部内容如下:
with tf.Graph().as_default():
# Define G and V the same way. No initialization or run here.
saver.restore(sess, '/B/somefolder/somefile')
对于机器A和B,变量在代码块末尾的状态是否相同?这是否保证适用于所有平台? Linux 的不同版本呢?
保存器使用简单的文件格式based on LevelDB to store a key-value table that maps variable names (as strings) to SavedTensorSlice
protocol buffers. The format is intended to work across all platforms, although it has mostly been tested on little-endian (i.e. x86-based) architectures. The same file should work across different versions of Linux, and between Linux and Mac OS X. If it doesn't, please raise an issue!
假设我在对一些 tf.Session
sess
和一些 tf.train.Saver
saver
进行一些计算后在机器 A 上执行以下命令,假设我有一些 tf.Graph
G
带有一些变量 V
:
with tf.Graph().as_default():
# Define G, V, initialize for sess, then run some computation
saver.save(sess, '/A/somefolder/somefile')
这将创建 somefile
、somefile.meta
,并在 somefolder
中更新 checkpoints
。
接下来,假设我在机器 B 上复制 somefolder
和 运行 的全部内容如下:
with tf.Graph().as_default():
# Define G and V the same way. No initialization or run here.
saver.restore(sess, '/B/somefolder/somefile')
对于机器A和B,变量在代码块末尾的状态是否相同?这是否保证适用于所有平台? Linux 的不同版本呢?
保存器使用简单的文件格式based on LevelDB to store a key-value table that maps variable names (as strings) to SavedTensorSlice
protocol buffers. The format is intended to work across all platforms, although it has mostly been tested on little-endian (i.e. x86-based) architectures. The same file should work across different versions of Linux, and between Linux and Mac OS X. If it doesn't, please raise an issue!