Skip to content
Permalink
Browse files

removed hard-coded instances of self.latent_dim = 100

  • Loading branch information...
yolpsoftware committed Jun 15, 2018
1 parent e59ca08 commit c52cdcbed812218ce1984c59a67dec588d9d6bdc
Showing with 4 additions and 4 deletions.
  1. +4 −4 gan/gan.py
@@ -34,7 +34,7 @@ def __init__(self):
self.generator = self.build_generator()

# The generator takes noise as input and generates imgs
z = Input(shape=(100,))
z = Input(shape=(self.latent_dim,))
img = self.generator(z)

# For the combined model we will only train the generator
@@ -112,7 +112,7 @@ def train(self, epochs, batch_size=128, sample_interval=50):
idx = np.random.randint(0, X_train.shape[0], batch_size)
imgs = X_train[idx]

noise = np.random.normal(0, 1, (batch_size, 100))
noise = np.random.normal(0, 1, (batch_size, self.latent_dim))

# Generate a batch of new images
gen_imgs = self.generator.predict(noise)
@@ -126,7 +126,7 @@ def train(self, epochs, batch_size=128, sample_interval=50):
# Train Generator
# ---------------------

noise = np.random.normal(0, 1, (batch_size, 100))
noise = np.random.normal(0, 1, (batch_size, self.latent_dim))

# Train the generator (to have the discriminator label samples as valid)
g_loss = self.combined.train_on_batch(noise, valid)
@@ -140,7 +140,7 @@ def train(self, epochs, batch_size=128, sample_interval=50):

def sample_images(self, epoch):
r, c = 5, 5
noise = np.random.normal(0, 1, (r * c, 100))
noise = np.random.normal(0, 1, (r * c, self.latent_dim))
gen_imgs = self.generator.predict(noise)

# Rescale images 0 - 1

0 comments on commit c52cdcb

Please sign in to comment.
You can’t perform that action at this time.