title: 'Cannot interpret feed_dict key as Tensor: Can not convert a int into a Tensor' when using probabilities.eval?
body: <p>I want to use tensor-flow to print all the probabilities for my own image. The following code works well for any mnist image that i get from online but does not work with my own images. Here is the whole code.</p>
  
  <pre><code>from PIL import Image
  import random
  from tensorflow.examples.tutorials.mnist import input_data
  import tensorflow as tf
  import numpy as np
  import scipy.ndimage
  from PIL import Image
  
  
  np.set_printoptions(threshold='nan')
  
  mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
  
  
  x = tf.placeholder(tf.float32, [None, 784])
  W = tf.Variable(tf.zeros([784, 10]))
  b = tf.Variable(tf.zeros([10]))
  
  y = tf.nn.softmax(tf.matmul(x, W) + b)
  y_ = tf.placeholder(tf.float32, [None, 10])
  
  cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y), reduction_indices=[1]))
  
  train_step = tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy)
  
  init = tf.initialize_all_variables()
  
  sess = tf.Session()
  sess.run(init)
  
  for i in range(1000):
      batch_xs, batch_ys = mnist.train.next_batch(1000)
      sess.run(train_step, feed_dict= {x: batch_xs, y_: batch_ys})
  
  print ("done with training")
  print ("\n\n\n")
  
  probabilities  = y
  
  img = Image.open('mnist_7_367.jpg').convert('L')  # convert image to 8-bit grayscale
  data = list(img.getdata()) # convert image data to a list of integers
  newList = [float(x) / 255.0 for x in data]
  newList1 = np.asarray(newList)
  batch_xs = np.reshape(newList1, (1, 784))
  batch_xs[batch_xs &lt; 0.1] = 0
  #print isinstance(newList1, list)
  print batch_xs
  
  
  counter = 0
  for x in probabilities.eval(feed_dict={x: batch_xs}, session = sess):
      print ('[')
      for y in x:
          print (counter, '{:f}'.format(float(y)))
          counter += 1
      print (']')
  
  hello = np.reshape(batch_xs, (28, 28))  
  
  
  Matrix = np.array([])
  
  for x in hello:
      for y in x:
          Matrix = np.append(Matrix, int(255 * y))    
  
  
  imageReal = np.reshape(Matrix, (28, 28))
  
  img = Image.fromarray(imageReal)
  img.show()
  
  sess.close()
  </code></pre>
  
  <p>The problem I am having is that</p>
  
  <pre><code>for x in probabilities.eval(feed_dict={x: batch_xs}, session = sess): 
  </code></pre>
  
  <p>is producing the following error:</p>
  
  <pre><code>Cannot interpret feed_dict key as Tensor: Can not convert a int into a Tensor.
  </code></pre>
  
  <p>I feel the problem is in session = sess part of the line.</p>