Skip to content

Instantly share code, notes, and snippets.

@MLWhiz
Last active July 30, 2020 09:05
Show Gist options
  • Select an option

  • Save MLWhiz/6ab63d45bc98aaf9c7c2888e45dfed5a to your computer and use it in GitHub Desktop.

Select an option

Save MLWhiz/6ab63d45bc98aaf9c7c2888e45dfed5a to your computer and use it in GitHub Desktop.
# Initialize BCELoss function
criterion = nn.BCELoss()
# Create batch of latent vectors that we will use to visualize
# the progression of the generator
fixed_noise = torch.randn(64, nz, 1, 1, device=device)
# Establish convention for real and fake labels during training
real_label = 1.
fake_label = 0.
# Setup Adam optimizers for both G and D
# Learning rate for optimizers
lr = 0.0002
# Beta1 hyperparam for Adam optimizers
beta1 = 0.5
optimizerD = optim.Adam(netD.parameters(), lr=lr, betas=(beta1, 0.999))
optimizerG = optim.Adam(netG.parameters(), lr=lr, betas=(beta1, 0.999))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment