-2

I have downloaded this code from Rob Romijnders work on GitHub, It shows how to train and evaluate times series data.

I tried to get new expectation using the trained models using this the following code:

 y_result = tf.nn.softmax(tf.matmul(x,h_fc2) + b_fc2)

then I followed that with this code in anther part to predict the results:

result_classes = sess.run(y_result, feed_dict={x: flat_pixels,keep_prob: 1.0})

But the following error has come up :

InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'Placeholder_1' with dtype bool
 [[Node: Placeholder_1 = Placeholder[dtype=DT_BOOL, shape=[], _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

The question is How to predict my new expectations? and why it error come up ? and how to solve this problem?

I think it is a problem concerning how to dial with Tensorflow API, framework, Trained model.

1 Answers1

0

Error is self explonatory - you did not provide required boolean value. For this code it is bn_train which denotes whether to train batch norm. Add it to your feed dict, just as it is passed in the code you are using.

The second part is that:

y_result = tf.nn.softmax(tf.matmul(x,h_fc2) + b_fc2)

makes no sense, you are asking your model to multiply data (x) by final layer, what about all the previous ones?

Prediction should be possible by doing

prediction = tf.argmax(h_fc2,1)

and then after training

sess.run(prediction, feed_dict={x: flat_pixels,keep_prob: 1.0, bn_train: False})
lejlot
  • 64,777
  • 8
  • 131
  • 164