Skip to content

Commit

Permalink
ACGAN : Remove lines with no effect (keras-team#4503)
Browse files Browse the repository at this point in the history
* Remove lines with no effect

* pep8

* Update mnist_acgan.py
  • Loading branch information
farizrahman4u authored and fchollet committed Nov 29, 2016
1 parent 24d6cca commit 79ec9b8
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions examples/mnist_acgan.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ def build_discriminator():
loss=['binary_crossentropy', 'sparse_categorical_crossentropy']
)

discriminator.trainable = True

# get our mnist data, and force it to be of shape (..., 1, 28, 28) with
# range [-1, 1]
(X_train, y_train), (X_test, y_test) = mnist.load_data()
Expand Down Expand Up @@ -217,19 +215,14 @@ def build_discriminator():
noise = np.random.uniform(-1, 1, (2 * batch_size, latent_size))
sampled_labels = np.random.randint(0, 10, 2 * batch_size)

# we want to fix the discriminator and let the generator train to
# trick it
discriminator.trainable = False

# we want to train the genrator to trick the discriminator
# For the generator, we want all the {fake, not-fake} labels to say
# not-fake
trick = np.ones(2 * batch_size)

epoch_gen_loss.append(combined.train_on_batch(
[noise, sampled_labels.reshape((-1, 1))], [trick, sampled_labels]))

discriminator.trainable = True

print('\nTesting for epoch {}:'.format(epoch + 1))

# evaluate the testing loss here
Expand Down

0 comments on commit 79ec9b8

Please sign in to comment.