Skip to content

Commit

Permalink
update xrange import in utils_tf
Browse files Browse the repository at this point in the history
  • Loading branch information
npapernot committed Aug 17, 2017
1 parent f0f3311 commit 8e40efb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cleverhans/utils_tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import math
import numpy as np
import os
import six
from six.moves import xrange
import tensorflow as tf
import time
import warnings
Expand Down Expand Up @@ -151,7 +151,7 @@ def model_train(sess, x, y, predictions, X_train, Y_train, save=False,
"CleverHans may drop support for this version.")
sess.run(tf.initialize_all_variables())

for epoch in six.moves.xrange(args.nb_epochs):
for epoch in xrange(args.nb_epochs):
# Compute number of batches
nb_batches = int(math.ceil(float(len(X_train)) / args.batch_size))
assert nb_batches * args.batch_size >= len(X_train)
Expand Down Expand Up @@ -312,13 +312,13 @@ def batch_eval(sess, tf_inputs, tf_outputs, numpy_inputs, feed=None,
assert n > 0
assert n == len(tf_inputs)
m = numpy_inputs[0].shape[0]
for i in six.moves.xrange(1, n):
for i in xrange(1, n):
assert numpy_inputs[i].shape[0] == m
out = []
for _ in tf_outputs:
out.append([])
with sess.as_default():
for start in six.moves.xrange(0, m, args.batch_size):
for start in xrange(0, m, args.batch_size):
batch = start // args.batch_size
if batch % 100 == 0 and batch > 0:
_logger.debug("Batch " + str(batch))
Expand Down

0 comments on commit 8e40efb

Please sign in to comment.