1
votes

Following is my code using tensorflow, and I have been trying to debug this error for two days...

changed_result = y_conv.eval(feed_dict={x: pixelNew, keep_prob: 1.0})

and:

changed_result = tf.Variable([0.0],tf.float32)

I have tried making changed_result a tensor or just not declaring it. Both won't work.

Below is the whole error description:

Traceback (most recent call last): File "deepMnist.py", line 235, in tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)

File "/Users/ximinlin/anaconda/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 43, in run sys.exit(main(sys.argv[:1] + flags_passthrough))

File "deepMnist.py", line 162, in main changed_result = y_conv.eval(feed_dict={x: pixelNew, keep_prob: 1.0}) File "/Users/ximinlin/anaconda/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 575, in eval return _eval_using_default_session(self, feed_dict, self.graph, session)

File "/Users/ximinlin/anaconda/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3633, in _eval_using_default_session return session.run(tensors, feed_dict)

File "/Users/ximinlin/anaconda/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 766, in run run_metadata_ptr)

File "/Users/ximinlin/anaconda/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 921, in _run + e.args[0]) TypeError: Cannot interpret feed_dict key as Tensor: Can not convert a int into a Tensor.

Following is definition of x and keep_pro:

x = tf.placeholder(tf.float32, [None, 784])

keep_prob = 0

keep_prob, and x are actually code from tensorflow tutorial, and I just copy them to my code

1

1 Answers

0
votes

You are not showing enough context to give a very concrete answer, but your error is that either x or keep_prob are not tensors, but an integer at the point where you call it (you might have overwritten them, if you defined them as tensors before).

So, the error is with x or keep_prob, not with changed_result.