My tensorflow version is 0.11. I want to save a graph after training or save something else which tensorflow can load it.
I/ Using Exporting and Importing a Met
Your first solution (using the MetaGraph) almost works, but the error arises because you are feeding a batch of flattened MNIST training examples to a tf.placeholder()
that expects a batch of MNIST training examples as a 4-D tensor with shape batch_size
x height
(= 28) x width
(= 28) x channels
(= 1). The easiest way to solve this is to reshape your input data. Instead of this statement:
print(i, np.mean(np.argmax(teY[test_indices], axis=1) ==
sess.run(predict_op, feed_dict={
"X:0": teX[test_indices],
"p_keep_conv:0": 1.0,
"p_keep_hidden:0": 1.0})))
...try the following statement, which reshapes your input data appropriately, instead:
print(i, np.mean(np.argmax(teY[test_indices], axis=1) ==
sess.run(predict_op, feed_dict={
"X:0": teX[test_indices].reshape(-1, 28, 28, 1),
"p_keep_conv:0": 1.0,
"p_keep_hidden:0": 1.0})))