Skip to content Skip to sidebar Skip to footer

Tensorflow: Use None In Output_shape In Conv2d_transpose

I would like to use a conv2d_tranpose (or deconvolution) instead of upsampling in my network. This requires passing an output_shape to the function call. That is not a problem, I c

Solution 1:

Instead of using None, please use symbolic representation like below.

batch_size = tf.shape(something_or_other)[0]  
deconv_shape = tf.pack([batch_size, 40, 40, 32])  
conv2d_transpose(..., output_shape=deconv_shape, ...)  

Be careful not to use tf.get_shape(). tf.get_shape() and tf.shape() are slightly different.

Also see recomendations in tensorflow site about variable batch size.

https://www.tensorflow.org/programmers_guide/faq

Post a Comment for "Tensorflow: Use None In Output_shape In Conv2d_transpose"