I was going to rewrite deconvolution into Pixcelshuffer in the generator of DCGAN, but that was not working well. Overusing Pixcelshuffer is taboo??
class GeneratorDCGANPixel(nn.Module):
def __init__(self, nz, ngf, nc):
super().__init__()
self.layers = nn.ModuleList([nn.Sequential(nn.Conv2d(nz, ngf * 8, 4, 2, 1, bias=False),
nn.PixelShuffle(2),
nn.ReLU(inplace=True)),
nn.Sequential(nn.Conv2d(128, ngf * 4, 4, 2, 1, bias=False),
nn.PixelShuffle(2),
nn.ReLU(inplace=True)),
nn.Sequential(nn.Conv2d(64, ngf * 2, 4, 2, 1, bias=False),
nn.PixelShuffle(2),
nn.ReLU(inplace=True)),
nn.Sequential(nn.Conv2d(32, ngf, 4, 2, 1, bias=False),
nn.PixelShuffle(2),
nn.ReLU(inplace=True)),
nn.Sequential(nn.Conv2d(16, nc * 4, 4, 2, 1, bias=False),
nn.PixelShuffle(2),
nn.Tanh())])
def forward(self, x):
for layer in self.layers:
x = layer(x)
return x