【问题标题】:FailedPreconditionError when saving variables in TensorFlow在 TensorFlow 中保存变量时出现 FailedPreconditionError
【发布时间】:2016-11-09 19:22:07
【问题描述】:

我试图通过表达式来保存权重

saver2 = tf.train.Saver(tf.all_variables())
saver2.save(sess, '/home/username/learning/tensor/tffiles/ww/')

但是由于这个错误导致保存失败:

FailedPreconditionError (see above for traceback): 
/home/username/learning/tensor/tffiles/ww/.tempstate2977384776137285958

[[Node: save_1/save = SaveSlices[T=[DT_FLOAT, DT_FLOAT, DT_FLOAT, 
DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, 
DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"]
(_recv_save_1/Const_0, save_1/save/tensor_names, 
save_1/save/shapes_and_slices, conv1/biases, conv1/weights, conv2/biases, 
conv2/weights, f1/_9, f2/_11, local3/biases, local3/weights, local4/biases, 
local4/weights, softmax_linear/biases, softmax_linear/weights)]]

错误从何而来?

【问题讨论】:

  • 你之前有没有初始化所有变量?
  • 我想到了但是变量似乎被初始化了,错误与'FailedPreconditionError: Attempting to use uninitialized value Variable_5'不同,不是吗?

标签: tensorflow


【解决方案1】:

问题出在线路上,

saver2.save(sess, '/home/username/learning/tensor/tffiles/ww/')

缺少明确指定ckpt文件的名称,应该是

saver2.save(sess, '/home/username/learning/tensor/tffiles/ww/model.ckpt')

【讨论】:

    猜你喜欢
    • 2017-12-12
    • 1970-01-01
    • 2016-08-14
    • 2020-08-05
    • 1970-01-01
    • 2016-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多