def __init__(self, density=1, size=64, latent_size=128, channel=3):
assert (size % 16 == 0)
initial_size = size / 16
super(Generator, self).__init__(
g1=L.Linear(latent_size, initial_size * initial_size * 256 * density, wscale=0.02 * math.sqrt(latent_size)),
norm1=L.BatchNormalization(initial_size * initial_size * 256 * density),
g2=L.Deconvolution2D(256 * density, 128 * density, 4, stride=2, pad=1,
wscale=0.02 * math.sqrt(4 * 4 * 256 * density)),
norm2=L.BatchNormalization(128 * density),
g3=L.Deconvolution2D(128 * density, 64 * density, 4, stride=2, pad=1,
wscale=0.02 * math.sqrt(4 * 4 * 128 * density)),
norm3=L.BatchNormalization(64 * density),
g4=L.Deconvolution2D(64 * density, 32 * density, 4, stride=2, pad=1,
wscale=0.02 * math.sqrt(4 * 4 * 64 * density)),
norm4=L.BatchNormalization(32 * density),
g5=L.Deconvolution2D(32 * density, channel, 4, stride=2, pad=1,
wscale=0.02 * math.sqrt(4 * 4 * 32 * density)),
)
self.density = density
self.latent_size = latent_size
self.initial_size = initial_size
评论列表
文章目录