cerebrou
cerebrou

Reputation: 5540

FailedPreconditionError when saving variables in TensorFlow

I attempted to save weights by the expression

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

But the save fails due to this error:

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)]]

Where does the error come from?

Upvotes: 1

Views: 787

Answers (1)

cerebrou
cerebrou

Reputation: 5540

The problem is with the line,

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

which lacks explicit specifying of the name of the ckpt file, and should be

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

Upvotes: 3

Related Questions