Algorithm 1. The training algorithm for DCGAN-GP. |
Input: Number of iterations , discriminator per iteration, training iterations , batch size , gradient penalty weight , discriminator update count limit
Randomly initialize generator network parameters and discriminator
# Train the discriminator
# Collect mini-batch samples
-
5.
-
6.
Randomly sample
# Compute the random interpolation points for the gradient penalty term.
-
7.
Sample
-
8.
# Calculate the loss function of the discriminator and update the parameters
-
9.
Calculate the loss function of the discriminator
-
10.
Calculate the gradient penalty term
-
11.
-
12.
# Train the generator
# Calculating the generator’s loss function and updating parameters
|