title: tf.nn.conv2d_transpose() double width and height for dynamic shapes of input tensor
body: <p>When I tried to use <strong>tf.nn.conv2d_transpose()</strong> to get layer result which has doubled width, height and halved depth, it worked while using specified <strong>[batch, width, height, channel(input and output)].</strong></p>
  <p>By setting <strong>batch_size=&quot;None&quot;,</strong> training works well for specified batch_size and validation works well for images(or an image).</p>
  <p>Now, I'm trying to make encoder-decoder network structure using training <strong>[128 x 128 x 3]</strong> images. (Those training images are cropped images from <strong>[w x h x 3]</strong> original images)</p>
  <p>Input shape is <strong>[128 x 128 x 3]</strong> and output shape is <strong>[128 x 128 x 3]</strong>. First layer is convolution layer with k=3x3, strides = 1, padding = 1 with encoder-decoder structure.</p>
  <p>All of the process above works well for specified width and height (128 x 128).</p>
  <p>However, after training is finished with training patches of <strong>[128 x 128 x 3]</strong>, I'd like to infer <strong>[w x h x 3]</strong> image using trained network.</p>
  <p>I guess all of the sequences : convolution, maxpool gives correct results, except transpose convolution.</p>
  <p>When I infer fixed shape of images <strong>[128 x 128 x 3]</strong> :</p>
  <pre><code>InputImagesTensor = tf.placeholder(tf.float32, [None, 128, 128, 3], name='InputImages')
  ResultImages = libs.Network(InputImagesTensor)
  saver = tf.train.Saver()
  w = 128
  h = 128
  
  sess = tf.Session()
  sess.run(tf.global_variables_initializer())
  saver.restore(sess, 'output.ckpt')
  for i in range(0, len(Datas.InputImageNameList)):
      temp = np.resize(getResizedImage(Datas.InputImageList[i]), (1, 128, 128, 3))
      resultimg = sess.run(ResultImages, feed_dict={InputImagesTensor: temp})
  </code></pre>
  <p>with network inside :</p>
  <pre><code>def Transpose2d(input, inC, outC):
      b, w, h, c = input.shape
  
      batch_size = tf.shape(input)[0]
      deconv_shape = tf.stack([batch_size, int(w*2), int(h*2), outC])
      kernel = tf.Variable(tf.random_normal([2, 2, outC, inC], stddev=0.01))
      output_shape = [None, int(w * 2), int(h * 2), outC]
      transConv = tf.nn.conv2d_transpose(input, kernel, output_shape=deconv_shape, strides=[1, 2, 2, 1], padding=&quot;SAME&quot;)
  
      return transConv
  </code></pre>
  <p>Now, I tried to convert them with fixed width and height to dynamic width and height.
  In my opinion, this would work (however it failed)</p>
  <p>Change</p>
  <pre><code>InputImagesTensor = tf.placeholder(tf.float32, [None, 128, 128, 3], name='InputImages')
  temp = np.resize(getResizedImage(Datas.InputImageList[i]), (1, 128, 128, 3))
  </code></pre>
  <p>to</p>
  <pre><code>InputImagesTensor = tf.placeholder(tf.float32, [None, None, None, 3], name='InputImages')
  temp = np.resize(getResizedImage(Datas.InputImageList[i]), (1, w, h, 3))
  </code></pre>
  <p>However, this line gives error.</p>
  <pre><code>deconv_shape = tf.stack([batch_size, int(w*2), int(h*2), outC])
  </code></pre>
  <p><strong>TypeError: <strong>int</strong> returned non-int (type NoneType)</strong></p>
  <p>I guess it is because we cannot double the <strong>None</strong> value to <strong>2*None</strong>.</p>
  <p>How can I do this?? is it possible??</p>