1+ from builtins import range
12import tensorflow as tf
23from tensorflow .contrib .framework .python .ops .variables import get_or_create_global_step
34from tensorflow .python .platform import tf_logging as logging
@@ -178,7 +179,7 @@ def run():
178179 images , _ , labels = load_batch (dataset , batch_size = batch_size )
179180
180181 #Know the number steps to take before decaying the learning rate and batches per epoch
181- num_batches_per_epoch = dataset .num_samples / batch_size
182+ num_batches_per_epoch = dataset .num_samples // batch_size
182183 num_steps_per_epoch = num_batches_per_epoch #Because one step is one batch processed
183184 decay_steps = int (num_epochs_before_decay * num_steps_per_epoch )
184185
@@ -245,8 +246,7 @@ def train_step(sess, train_op, global_step):
245246
246247 #Run the managed session
247248 with sv .managed_session () as sess :
248- for step in xrange (num_steps_per_epoch * num_epochs ):
249- # for step in xrange(1):
249+ for step in range (num_steps_per_epoch * num_epochs ):
250250 #At the start of every epoch, show the vital information:
251251 if step % num_batches_per_epoch == 0 :
252252 logging .info ('Epoch %s/%s' , step / num_batches_per_epoch + 1 , num_epochs )
@@ -256,10 +256,10 @@ def train_step(sess, train_op, global_step):
256256
257257 # optionally, print your logits and predictions for a sanity check that things are going fine.
258258 logits_value , probabilities_value , predictions_value , labels_value = sess .run ([logits , probabilities , predictions , labels ])
259- print 'logits: \n ' , logits_value [:5 ]
260- print 'Probabilities: \n ' , probabilities_value [:5 ]
261- print 'predictions: \n ' , predictions_value [:5 ]
262- print 'Labels:\n :' , labels_value [:5 ]
259+ print ( 'logits: \n ' , logits_value [:5 ])
260+ print ( 'Probabilities: \n ' , probabilities_value [:5 ])
261+ print ( 'predictions: \n ' , predictions_value [:5 ])
262+ print ( 'Labels:\n :' , labels_value [:5 ])
263263
264264 #Log the summaries every 10 step.
265265 if step % 10 == 0 :
0 commit comments