@@ -75,7 +75,7 @@ def __init__(self, numpy_rng, theano_rng=None, n_ins=784,
7575 # training the DBN by doing stochastic gradient descent on the
7676 # MLP.
7777
78- for i in xrange (self .n_layers ):
78+ for i in range (self .n_layers ):
7979 # construct the sigmoidal layer
8080
8181 # the size of the input is either the number of hidden
@@ -267,11 +267,11 @@ def build_finetune_functions(self, datasets, batch_size, learning_rate):
267267
268268 # Create a function that scans the entire validation set
269269 def valid_score ():
270- return [valid_score_i (i ) for i in xrange (n_valid_batches )]
270+ return [valid_score_i (i ) for i in range (n_valid_batches )]
271271
272272 # Create a function that scans the entire test set
273273 def test_score ():
274- return [test_score_i (i ) for i in xrange (n_test_batches )]
274+ return [test_score_i (i ) for i in range (n_test_batches )]
275275
276276 return train_fn , valid_score , test_score
277277
@@ -329,12 +329,12 @@ def test_DBN(finetune_lr=0.1, pretraining_epochs=100,
329329 print '... pre-training the model'
330330 start_time = timeit .default_timer ()
331331 ## Pre-train layer-wise
332- for i in xrange (dbn .n_layers ):
332+ for i in range (dbn .n_layers ):
333333 # go through pretraining epochs
334- for epoch in xrange (pretraining_epochs ):
334+ for epoch in range (pretraining_epochs ):
335335 # go through the training set
336336 c = []
337- for batch_index in xrange (n_train_batches ):
337+ for batch_index in range (n_train_batches ):
338338 c .append (pretraining_fns [i ](index = batch_index ,
339339 lr = pretrain_lr ))
340340 print 'Pre-training layer %i, epoch %d, cost ' % (i , epoch ),
@@ -379,7 +379,7 @@ def test_DBN(finetune_lr=0.1, pretraining_epochs=100,
379379
380380 while (epoch < training_epochs ) and (not done_looping ):
381381 epoch = epoch + 1
382- for minibatch_index in xrange (n_train_batches ):
382+ for minibatch_index in range (n_train_batches ):
383383
384384 minibatch_avg_cost = train_fn (minibatch_index )
385385 iter = (epoch - 1 ) * n_train_batches + minibatch_index
0 commit comments