So i was following the zero to gans course, completed it. Wanted to adjust the code to generate the mnist integers instead of anime faces. I wrote this generator
# in: latent_size x 1 x 1
nn.ConvTranspose2d(latent_size, 512, kernel_size=3, stride=1, padding=0, bias=False),
nn.BatchNorm2d(512),
nn.ReLU(True),
# out: 512 x 3 x 3
nn.ConvTranspose2d(512, 256, kernel_size=3, stride=2, padding=0, bias=False),
nn.BatchNorm2d(256),
nn.ReLU(True),
# out: 256 x 7 x 7
nn.ConvTranspose2d(256, 128, kernel_size=4, stride=2, padding=1, bias=False),
nn.BatchNorm2d(128),
nn.ReLU(True),
# out: 128 x 14 x 14
# Self attention layer
nn.Conv2d(128, 128, kernel_size=1, stride=1, padding=0, bias=False),
nn.BatchNorm2d(128),
nn.ReLU(True),
# out: 128 x 14 x 14
nn.ConvTranspose2d(128, 1, kernel_size=4, stride=2, padding=1, bias=False),
nn.Tanh()
# out: 1 x 28 x 28
)```
However it just refuses to train?
If i use this one (and resize the mnist images to 64x64) it works
```generator = nn.Sequential(
# in: latent_size x 1 x 1
nn.ConvTranspose2d(latent_size, 512, kernel_size=4, stride=1, padding=0, bias=False),
nn.BatchNorm2d(512),
nn.ReLU(True),
# out: 512 x 4 x 4
nn.ConvTranspose2d(512, 256, kernel_size=4, stride=2, padding=1, bias=False),
nn.BatchNorm2d(256),
nn.ReLU(True),
# out: 256 x 8 x 8
nn.ConvTranspose2d(256, 128, kernel_size=4, stride=2, padding=1, bias=False),
nn.BatchNorm2d(128),
nn.ReLU(True),
# out: 128 x 16 x 16
nn.ConvTranspose2d(128, 64, kernel_size=4, stride=2, padding=1, bias=False),
nn.BatchNorm2d(64),
nn.ReLU(True),
# out: 64 x 32 x 32
nn.ConvTranspose2d(64, 1, kernel_size=4, stride=2, padding=1, bias=False),
nn.Tanh()
# out: 1 x 64 x 64
)