我试图通过表达式
来保存权重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)]]
错误来自哪里?
答案 0 :(得分:3)
问题出在线上,
saver2.save(sess, '/home/username/learning/tensor/tffiles/ww/')
缺少明确指定ckpt文件的名称,应该是
saver2.save(sess, '/home/username/learning/tensor/tffiles/ww/model.ckpt')