Skip to content

Commit

Permalink
fix use of data
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Goodfellow committed Jun 19, 2014
1 parent f77a509 commit 8139a55
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sgd.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,12 +455,14 @@ def train(self, dataset):
for batch in iterator:
for callback in on_load_batch:
callback(*batch)
self.d_func(*batch)
i += 1
if i == self.discriminator_steps:
# Generator doesn't actually use the data so we want to
# re-use this batch. Could save memory by making the
# code not expect data in the interface.
self.g_func(*batch)
i = 0
else:
self.d_func(*batch)
i += 1
# iterator might return a smaller batch if dataset size
# isn't divisible by batch_size
# Note: if data_specs[0] is a NullSpace, there is no way to know
Expand Down

0 comments on commit 8139a55

Please sign in to comment.