title: Shape of placeholder in Tensorflow
body: <p>I'm using Tensorflow for a short time. Here is my problem : 
  I load AlexNet weights to do fine tuning on it, so i give batch of size 50.
  So i defined :</p>
  
  <pre><code># Graph input
  x = tf.placeholder(tf.float32, [50, 227, 227, 3])
  y = tf.placeholder(tf.float32, [None, 40])
  </code></pre>
  
  <p>I give a batch of 50 images and want to get 40 output classes.</p>
  
  <p>Then I defined my model </p>
  
  <pre><code>class Model:
  @staticmethod 
  def alexnet(_X, _dropout):
      # Layer 1 (conv-relu-pool-lrn)
      conv1 = conv(_X, 11, 11, 96, 4, 4, padding='VALID', name='conv1')
      conv1 = max_pool(conv1, 3, 3, 2, 2, padding='VALID', name='pool1')
      norm1 = lrn(conv1, 2, 2e-05, 0.75, name='norm1')
      # Layer 2 (conv-relu-pool-lrn)
      conv2 = conv(norm1, 5, 5, 256, 1, 1, group=2, name='conv2')
      conv2 = max_pool(conv2, 3, 3, 2, 2, padding='VALID', name='pool2')
      norm2 = lrn(conv2, 2, 2e-05, 0.75, name='norm2')
      # Layer 3 (conv-relu)
      conv3 = conv(norm2, 3, 3, 384, 1, 1, name='conv3')
      # Layer 4 (conv-relu)
      conv4 = conv(conv3, 3, 3, 384, 1, 1, group=2, name='conv4')
      # Layer 5 (conv-relu-pool)
      conv5 = conv(conv4, 3, 3, 256, 1, 1, group=2, name='conv5')
      pool5 = max_pool(conv5, 3, 3, 2, 2, padding='VALID', name='pool5')
      # Layer 6 (fc-relu-drop)
      fc6 = tf.reshape(pool5, [-1, 6*6*256])
      fc6 = fc(fc6, 6*6*256, 4096, name='fc6')
      fc6 = dropout(fc6, _dropout)
      # Layer 7 (fc-relu-drop)
      fc7 = fc(fc6, 4096, 4096, name='fc7')
      fc7 = dropout(fc7, _dropout)
      # Layer 8 (fc-prob)
      fc8 = fc(fc7, 4096, 40, relu=False, name='fc8')
      return fc8 # fc8 and fc7 (for transfer-learning)
  </code></pre>
  
  <p>and create it </p>
  
  <pre><code>keep_var = tf.placeholder(tf.float32)
  
  # Model
  pred = Model.alexnet(x, keep_var)  
  </code></pre>
  
  <p>I can do the training, it works well, but at the end, i want to give only one image, but the x placeholder and y placeholder are defined for 50 images so it raises an error.
  Here is my code after the training to give only one image : </p>
  
  <pre><code>    x_test = tf.placeholder(tf.float32, [1, 227, 227, 3])
      y_test = tf.placeholder(tf.float32, [None, 40])
      img = loaded_img_train[0][:][:][:] # Only one image
      label = loaded_lab_train[0][:] # Only one label
      prediction = sess.run(pred, feed_dict={x_test: [img],     y_test: [label], keep_var: 1.})
  </code></pre>
  
  <p>And it raises me this error : </p>
  
  <pre><code>InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'Placeholder' with dtype float and shape [50,227,227,3]
   [[Node: Placeholder = Placeholder[dtype=DT_FLOAT, shape=[50,227,227,3], _device="/job:localhost/replica:0/task:0/cpu:0"]()]]
  </code></pre>
  
  <p>I can't figured out how to feed the input size I want.</p>
  
  <p>My exercise is directly inspired from the flower recognition with cnn </p>
  
  <p>Thanks a lot for your help ! 
  Guillaume</p>