Search code examples
pythontensorflowmachine-learningconvolutiondeconvolution

What defines the output tensor shape of tf.layers.conv2d_transpose?


When using tf.layers.conv2d_transpose what defines the output tensor shape?

For example: if the input was 4x4x512, for the output to be 8x8x256 the filters can be given, but how are is the height and width defined? Or else is it always two times the input height and width?

Thanks.


Solution

  • Check this answer it provides a formula that answers your question. https://stackoverflow.com/a/43624992/7431458

    From the above it is the stride, padding, kernel shape and input shape that defines the output shape. You also have to set the output shape parameter to let Tensorflow know what the intended shape is because of some side cases mentioned in the above link.

    For better explanation of what transpose convolution does check here:

    https://towardsdatascience.com/types-of-convolutions-in-deep-learning-717013397f4d