def __init__(self, latent_dim): super(Generator, self).__init__() self.net = nn.Sequential(helpers.Flatten(), nn.Linear(latent_dim, 500), nn.Softplus(), nn.BatchNorm1d(500), nn.Linear(500, 500), nn.Softplus(), nn.BatchNorm1d(500), nn.Linear(500, 32 * 32), nn.Tanh(), helpers.Reshape((1, 32, 32)))
def __init__(self, latent_dim): super(Generator, self).__init__() self.net = nn.Sequential( nn.Linear(latent_dim, 512 * 4 * 4), nn.BatchNorm1d(512 * 4 * 4), nn.ReLU(), helpers.Reshape((512, 4, 4)), nn.ConvTranspose2d(512, 256, 4, stride=2, padding=1), nn.BatchNorm2d(256), nn.ReLU(), nn.ConvTranspose2d(256, 128, 4, stride=2, padding=1), nn.BatchNorm2d(128), nn.ReLU(), nn.ConvTranspose2d(128, 1, 4, stride=2, padding=1), nn.Tanh(), )