The output of your model contains 20 channels and a single pixel, which doesn’t fit the input dimension of the MNIST-like input data.
If you want to reconstruct the input, you would have to use 1 output channel in the last transposed convolution and would need to increase the spatial size by using a kernel_size in the nn.ConvTranspose2d layers, which is larger than 1.