Skip to content

Commit

Permalink
GAN bug fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ragav Venkatesan committed Mar 5, 2017
1 parent 4587d9c commit 34f2ed8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions yann/modules/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,18 +230,18 @@ def create_updates(self, params, verbose = 1):
elif self.optimizer_type == 'adam':
""" Kingma, Diederik, and Jimmy Ba. "Adam: A method for stochastic optimization."
arXiv preprint arXiv:1412.6980 (2014)."""
if not self.momentum_type == '_adam':
if not self.momentum_type == 'adam':
if verbose >= 3 and not self.momentum_type == 'false':
print "... ADAM doesn't need explicit momentum. Momentum is removed."
self.momentum_type = '_adam'
self.momentum_type = 'adam'


current_acc_2 = b1 * acc_2 + (1-b1) * gradient
current_acc_1 = b2 * acc_1 + (1-b2) * T.sqr( gradient )
self.updates[acc_2] = current_acc_2
self.updates[acc_1] = current_acc_1

if self.momentum_type == '_adam':
if self.momentum_type == 'adam':
self.updates[velocity] = a * current_acc_2 / (T.sqrt(current_acc_1) +
fudge_factor)

Expand Down
4 changes: 2 additions & 2 deletions yann/special/gan.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ def print_status (self, epoch , verbose = 2):
raise Exception(" Cook first then run this.")

if len(discriminator_probability) < self.batches2train * self.mini_batches_per_batch[0]:
print(".. Discriminator Real Sigmoid D(x) : " + str(discriminator_probability[-1]))
print(".. Discriminator Sigmoid D(x) : " + str(discriminator_probability[-1]))
else:
print(".. Discriminator Real Sigmoid D(x) : " + str(numpy.mean(\
print(".. Discriminator Sigmoid D(x) : " + str(numpy.mean(\
discriminator_probability[-1 * self.batches2train * self.mini_batches_per_batch[0]:])))

if len(generator_probability) < self.batches2train * self.mini_batches_per_batch[0]:
Expand Down

0 comments on commit 34f2ed8

Please sign in to comment.