@@ -290,12 +290,11 @@ def train(self, config):
290290 errD_real = self .d_loss_real .eval ({ self .inputs : batch_images })
291291 errG = self .g_loss .eval ({self .z : batch_z })
292292
293- counter += 1
294- print ("Epoch: [%2d/%2d] [%4d/%4d] time: %4.4f, d_loss: %.8f, g_loss: %.8f" \
295- % (epoch , config .epoch , idx , batch_idxs ,
293+ print ("[%8d Epoch:[%2d/%2d] [%4d/%4d] time: %4.4f, d_loss: %.8f, g_loss: %.8f" \
294+ % (counter , epoch , config .epoch , idx , batch_idxs ,
296295 time .time () - start_time , errD_fake + errD_real , errG ))
297296
298- if np .mod (counter , 100 ) == 1 :
297+ if np .mod (counter , config . sample_freq ) == 0 :
299298 if config .dataset == 'mnist' :
300299 samples , d_loss , g_loss = self .sess .run (
301300 [self .sampler , self .d_loss , self .g_loss ],
@@ -306,7 +305,7 @@ def train(self, config):
306305 }
307306 )
308307 save_images (samples , image_manifold_size (samples .shape [0 ]),
309- './{}/train_{:02d}_{:04d} .png' .format (config .sample_dir , epoch , idx ))
308+ './{}/train_{:08d} .png' .format (config .sample_dir , counter ))
310309 print ("[Sample] d_loss: %.8f, g_loss: %.8f" % (d_loss , g_loss ))
311310 else :
312311 try :
@@ -318,14 +317,16 @@ def train(self, config):
318317 },
319318 )
320319 save_images (samples , image_manifold_size (samples .shape [0 ]),
321- './{}/train_{:02d}_{:04d} .png' .format (config .sample_dir , epoch , idx ))
320+ './{}/train_{:08d} .png' .format (config .sample_dir , counter ))
322321 print ("[Sample] d_loss: %.8f, g_loss: %.8f" % (d_loss , g_loss ))
323322 except :
324323 print ("one pic error!..." )
325324
326- if np .mod (counter , 500 ) == 2 :
325+ if np .mod (counter , config . ckpt_freq ) == 0 :
327326 self .save (config .checkpoint_dir , counter )
328-
327+
328+ counter += 1
329+
329330 def discriminator (self , image , y = None , reuse = False ):
330331 with tf .variable_scope ("discriminator" ) as scope :
331332 if reuse :
0 commit comments