# Create the generator netG = Generator(ngpu).to(device) # Handle multi-GPU if desired if (device.type == 'cuda') and (ngpu > 1): netG = nn.DataParallel(netG, list(range(ngpu))) # Apply the ``weights_init`` function to randomly initialize all weights # to ``mean=0``, ``stdev=0.02``. netG.apply(weights_init) # Print the model print(netG)