我使用tf.saved_model
保存了TensorFlow模型,现在我尝试使用tf.train.Saver
仅加载来自该模型的变量,但是根据路径我得到以下两个错误之一给它:
DataLossError: Unable to open table file saved_model/variables:
Failed precondition: saved_model/variables: perhaps your file is in a
different file format and you need to use a different restore operator?
或
InvalidArgumentError: Unsuccessful TensorSliceReader constructor:
Failed to get matching files on saved_model/variables/variables:
Not found: saved_model/variables
[[Node: save/RestoreV2_34 = RestoreV2[dtypes=[DT_FLOAT],
_device="/job:localhost/replica:0/task:0/cpu:0"]
(_arg_save/Const_1_0_0,
save/RestoreV2_34/tensor_names, save/RestoreV2_34/shape_and_slices)]]
tf.saved_model
,在保存模型时,会创建一个saved_model.pb
协议缓冲区和一个名为variables
的文件夹,其中包含两个文件:
variables.data-00000-of-00001
variables.index
tf.train.Saver.save()
创建以下文件:
some_name.data-00000-of-00001
some_name.index
some_name.meta
checkpoint
我一直认为以.data-00000-of-00001
和.index
结尾的两个输出文件在两个储户之间是兼容的。
情况不是这样吗?