Skip to content

Commit ab30f73

Browse files
ozabludafchollet
authored andcommitted
Fix off-by-one display errors for batch and epoch (keras-team#8193)
1 parent 9c79e01 commit ab30f73

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

examples/mnist_acgan.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ def build_discriminator():
182182
train_history = defaultdict(list)
183183
test_history = defaultdict(list)
184184

185-
for epoch in range(epochs):
186-
print('Epoch {} of {}'.format(epoch + 1, epochs))
185+
for epoch in range(1, epochs + 1):
186+
print('Epoch {} of {}'.format(epoch, epochs))
187187

188188
num_batches = int(X_train.shape[0] / batch_size)
189189
progress_bar = Progbar(target=num_batches)
@@ -192,7 +192,6 @@ def build_discriminator():
192192
epoch_disc_loss = []
193193

194194
for index in range(num_batches):
195-
progress_bar.update(index)
196195
# generate a new batch of noise
197196
noise = np.random.uniform(-1, 1, (batch_size, latent_size))
198197

@@ -232,7 +231,9 @@ def build_discriminator():
232231
[noise, sampled_labels.reshape((-1, 1))],
233232
[trick, sampled_labels]))
234233

235-
print('\nTesting for epoch {}:'.format(epoch + 1))
234+
progress_bar.update(index + 1)
235+
236+
print('Testing for epoch {}:'.format(epoch))
236237

237238
# evaluate the testing loss here
238239

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy