Skip to content

Commit

Permalink
Update acgan.py
Browse files Browse the repository at this point in the history
  • Loading branch information
2ndMessiah authored Jul 30, 2019
1 parent 44d3320 commit 88591d8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions acgan/acgan.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def build_generator(self):

noise = Input(shape=(self.latent_dim,))
label = Input(shape=(1,), dtype='int32')
label_embedding = Flatten()(Embedding(self.num_classes, 100)(label))
label_embedding = Flatten()(Embedding(self.num_classes, self.latent_dim)(label))

model_input = multiply([noise, label_embedding])
img = model(model_input)
Expand Down Expand Up @@ -141,7 +141,7 @@ def train(self, epochs, batch_size=128, sample_interval=50):
imgs = X_train[idx]

# Sample noise as generator input
noise = np.random.normal(0, 1, (batch_size, 100))
noise = np.random.normal(0, 1, (batch_size, self.latent_dim))

# The labels of the digits that the generator tries to create an
# image representation of
Expand Down Expand Up @@ -175,7 +175,7 @@ def train(self, epochs, batch_size=128, sample_interval=50):

def sample_images(self, epoch):
r, c = 10, 10
noise = np.random.normal(0, 1, (r * c, 100))
noise = np.random.normal(0, 1, (r * c, self.latent_dim))
sampled_labels = np.array([num for _ in range(r) for num in range(c)])
gen_imgs = self.generator.predict([noise, sampled_labels])
# Rescale images 0 - 1
Expand Down

0 comments on commit 88591d8

Please sign in to comment.