0
$\begingroup$

I have been learning GAN (Generative Adversarial Networks) lately and having a hard time understanding the output size for transpose convolution. Let's say I am using a Tensor of [1, 64, 1, 1] as an input noise. How do I calculate the output of each layer until I construct a 28x28 image (let's say an MNIST digit)? What should be the kernel size, stride, and padding and assuming I use 3 or 4 layers to reconstruct the 28x28 image?

Note: A handwritten example will be enough as well.

$\endgroup$

1 Answer 1

1
$\begingroup$
output_size = (input_size - 1) * stride + kernel_size - 2 * padding + output_padding + 1

Padding refers to adding extra pixels around the input feature map to control the spatial size of the output feature maps. This is done to ensure that the spatial dimensions of the input and output feature maps are the same, which can be useful for maintaining the spatial dimensions of the feature maps as they pass through multiple convolutional layers. By adding padding, the output feature map will have the same spatial dimensions as the input feature map, but with a reduced resolution.

Output padding, on the other hand, is used to increase the spatial size of the output feature map compared to the input feature map. This is done by adding extra pixels to the output feature map after the convolutional operation has been performed. Output padding can be useful in situations where it is necessary to increase the spatial resolution of the feature maps.

$\endgroup$
1
  • $\begingroup$ Let's say I am using a Tensor of [1, 64, 1, 1] as an input noise. How do I calculate the output of each layer until I construct a 28x28 image (let's say an MNIST digit)? $\endgroup$
    – pwnkit
    Commented Feb 14, 2023 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.