title: Dimensions must be equal, but are 64 and 1 for 'Conv2D_13' (op: 'Conv2D') with input shapes: [?,28,28,64], [3,3,1,64]
body: <p>I am doing data Digital recognition in kaggle  by using cnn. 
  I am getting this error:</p>
  
  <blockquote>
    <p>Dimensions must be equal, but are 64 and 1 for 'Conv2D_13' (op: 'Conv2D') with input shapes: [?,28,28,64], [3,3,1,64].</p>
  </blockquote>
  
  <p>I don't know why and the output shape different from my # symbol. For example, I think it should be (26,26,24) but the result actually is (?, 28, 28, 64).
  if you know. please tell me. thanks!</p>
  
  <p>My code is:</p>
  
  <pre><code>X=tf.placeholder(tf.float32,(None,28,28,1),"X")
  y=tf.placeholder(tf.int32,(None,10),"y")
  
  #conv1
  filter1=tf.Variable(tf.truncated_normal((3,3,1,64)))
  x=tf.nn.relu(tf.nn.conv2d(X,filter1,strides[1,1,1,1],padding="SAME"),name='relu_1') 
  #(26,26,24)
  print(x.shape) #(?, 28, 28, 64) 
  filter2=tf.Variable(tf.truncated_normal((3,3,1,64)))
  x=tf.nn.relu(tf.nn.conv2d(x,filter2,strides[1,1,1,1],padding="SAME"),name='relu_2') 
  #(24,24,64)
  x = tf.nn.max_pool(x, ksize=[1,2,2,1], strides=[1,2,2,1],padding="VALID") 
  #(12,12,64)
  filter3=tf.Variable(tf.truncated_normal((3,3,1,128)))
  x=tf.nn.relu(tf.nn.conv2d(x,filter3,strides=[1,1,1,1],padding="SAME"),name='relu_3') 
  #(10,10,128)
  filter4=tf.Variable(tf.truncated_normal((3,3,1,128)))
  x=tf.nn.relu(tf.nn.conv2d(x,filter4,strides=[1,1,1,1],padding="SAME"),name='relu_4')
  #(8,8,128)
  x = tf.nn.max_pool(x, ksize=[1,2,2,1], strides=[1,2,2,1],padding="VALID")                 
  #(4,4,128)
  fc_weight=tf.Variable(tf.truncated_normal((16*128,10)))
  logits= tf.add(tf.matmul(x, fc_weight), name = 'logits')
  y_proba=tf.nn.softmax(logits)
  
  #cost
  xentropy = tf.nn.sparse_softmax_cross_entropy_with_logits(labels=y,logits=logits)
  loss = tf.reduce_mean(xentropy, name="loss")
  
  #optimizer
  lr = tf.placeholder(dtype=tf.float32, name="lr")
  optimizer = tf.train.AdamOptimizer(lr)
  training_op = optimizer.minimize(loss)
  
  #evaluation
  correct = tf.nn.in_top_k(logits, y, 1)
  accuracy = tf.reduce_mean(tf.cast(correct, tf.float32))
  
  def shuffle_batch(X, y, batch_size):
      rnd_idx = np.random.permutation(len(X))
      n_batches = len(X) // batch_size
      for batch_idx in np.array_split(rnd_idx, n_batches):
          X_batch, y_batch = X[batch_idx], y[batch_idx]
          yield X_batch, y_batch
  
  n_epochs = 5
  batch_size = 68
  
  init = tf.global_variables_initializer()
  with tf.Session() as sess:
      init.run()
      for epoch in range(n_epochs):
          for X_batch, y_batch in shuffle_batch(X_train, y_train, batch_size):
              sess.run(training_op, feed_dict={X: X_batch, y: y_batch})
          accuracy_val = accuracy.eval(feed_dict={X: X_valid, y: y_valid})
          print(epoch, "Validation accuracy:", accuracy_val)
  </code></pre>