title: Getting the output shape of deconvolution layer using tf.nn.conv2d_transpose in tensorflow
body: <p>According to this <a href="http://www.matthewzeiler.com/pubs/cvpr2010/cvpr2010.pdf" rel="noreferrer">paper</a>, the output shape is <code>N + H - 1</code>, <code>N</code> is input height or width, <code>H</code> is kernel height or width. This is obvious inverse process of convolution. This <a href="http://cs231n.github.io/convolutional-networks/" rel="noreferrer">tutorial</a> gives a formula to calculate the output shape of convolution which is <code>(W−F+2P)/S+1</code>, <code>W</code> - input size, <code>F</code> - filter size, <code>P</code> - padding size, <code>S</code> - stride. But in <a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/nn_test.py" rel="noreferrer">Tensorflow</a>, there are test cases like:         </p>
  
  <pre><code>  strides = [1, 2, 2, 1]
  
    # Input, output: [batch, height, width, depth]
    x_shape = [2, 6, 4, 3]
    y_shape = [2, 12, 8, 2]
  
    # Filter: [kernel_height, kernel_width, output_depth, input_depth]
    f_shape = [3, 3, 2, 3]
  </code></pre>
  
  <p>So we use <code>y_shape</code>, <code>f_shape</code> and <code>x_shape</code>, according to formula <code>(W−F+2P)/S+1</code> to calculate padding size <code>P</code>. From <code>(12 - 3 + 2P) / 2 + 1 = 6</code>, we get <code>P = 0.5</code>, which is not an integer. How does deconvolution works in Tensorflow?</p>