Skip to content

Commit

Permalink
Merge pull request tensorflow#3206 from cclauss/from-six.moves-import…
Browse files Browse the repository at this point in the history
…-xrange

from six.moves import xrange (en masse)
  • Loading branch information
nealwu authored Jan 22, 2018
2 parents 6fc65ee + 848cc59 commit d90d528
Show file tree
Hide file tree
Showing 74 changed files with 82 additions and 22 deletions.
1 change: 1 addition & 0 deletions research/brain_coder/common/config_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import ast
import itertools
from six.moves import xrange


class Config(dict):
Expand Down
1 change: 1 addition & 0 deletions research/brain_coder/common/schedules_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from math import exp
from math import sqrt
import numpy as np
from six.moves import xrange
import tensorflow as tf

from common import config_lib # brain coder
Expand Down
1 change: 1 addition & 0 deletions research/brain_coder/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from absl import logging
import numpy as np
from six.moves import xrange
import tensorflow as tf


Expand Down
1 change: 1 addition & 0 deletions research/brain_coder/single_task/code_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from absl import logging
import numpy as np
from six.moves import xrange

from common import bf # brain coder
from common import reward as r # brain coder
Expand Down
2 changes: 1 addition & 1 deletion research/brain_coder/single_task/ga_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from absl import flags
from absl import logging
import numpy as np
from six.moves import xrange

from common import bf # brain coder
from common import utils # brain coder
Expand Down Expand Up @@ -469,4 +470,3 @@ def __init__(self, *args):

def random_individual(genome_size):
return lambda: Individual(np.random.choice(GENES, genome_size).tolist())

2 changes: 1 addition & 1 deletion research/brain_coder/single_task/ga_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from absl import flags
from absl import logging
import numpy as np
from six.moves import xrange
import tensorflow as tf

from common import utils # brain coder
Expand Down Expand Up @@ -321,4 +322,3 @@ def run_random_search(max_num_programs, checkpoint_dir, task_eval_fn,
solution_found=found_solution, generations=num_programs_seen,
num_programs=num_programs_seen, max_generations=max_num_programs,
max_num_programs=max_num_programs)

2 changes: 1 addition & 1 deletion research/brain_coder/single_task/pg_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from absl import logging
import numpy as np
from six.moves import xrange
import tensorflow as tf

from common import rollout as rollout_lib # brain coder
Expand Down Expand Up @@ -1294,4 +1295,3 @@ def process_episodes(
batch_targets = np.array([], dtype=np.float32)

return (batch_targets, batch_returns)

1 change: 1 addition & 0 deletions research/brain_coder/single_task/pg_agent_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from absl import logging
import numpy as np
from six.moves import xrange
import tensorflow as tf

from common import utils # brain coder
Expand Down
2 changes: 1 addition & 1 deletion research/brain_coder/single_task/results_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from collections import namedtuple
import os
import re
from six.moves import xrange
import tensorflow as tf


Expand Down Expand Up @@ -152,4 +153,3 @@ def read_all(self, num_shards=None):
r for shard_results in results_per_shard for r in shard_results]

return aggregate, shard_stats

1 change: 1 addition & 0 deletions research/brain_coder/single_task/results_lib_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
import shutil
import tempfile
from six.moves import xrange
import tensorflow as tf

from single_task import results_lib # brain coder
Expand Down
3 changes: 1 addition & 2 deletions research/brain_coder/single_task/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

"""Tasks that test correctness of algorithms."""

from six.moves import xrange
from common import reward as reward_lib # brain coder
from single_task import misc # brain coder

Expand Down Expand Up @@ -124,5 +125,3 @@ def __call__(self, actions):
# closest next element.
# Maximum distance possible is num_actions * base / 2 = 3 * 8 / 2 = 12
return (len(prefix) + (1 - min_dist / 12.0)), False


1 change: 1 addition & 0 deletions research/brain_coder/single_task/tune.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from absl import flags
from absl import logging
import numpy as np
from six.moves import xrange
import tensorflow as tf

from single_task import defaults # brain coder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import os

import numpy as np
from six.moves import xrange
import tensorflow as tf

import synthetic_model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"""Binary code sample generator."""

import numpy as np
from six.moves import xrange


_CRC_LINE = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"""Define some typical masked 2D convolutions."""

import numpy as np
from six.moves import xrange
import tensorflow as tf

import block_util
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from __future__ import unicode_literals

import numpy as np
from six.moves import xrange
import tensorflow as tf

import blocks_masked_conv2d
Expand Down
1 change: 1 addition & 0 deletions research/compression/entropy_coder/lib/blocks_std_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import os

import numpy as np
from six.moves import xrange
import tensorflow as tf

import blocks_std
Expand Down
1 change: 1 addition & 0 deletions research/delf/delf/python/feature_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from delf import feature_pb2
from delf import datum_io
import numpy as np
from six.moves import xrange
import tensorflow as tf


Expand Down
1 change: 1 addition & 0 deletions research/differential_privacy/dp_sgd/dp_mnist/dp_mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import time

import numpy as np
from six.moves import xrange
import tensorflow as tf

from differential_privacy.dp_sgd.dp_optimizer import dp_optimizer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import collections

from six.moves import xrange
import tensorflow as tf

OrderedDict = collections.OrderedDict
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from __future__ import print_function

import numpy as np
from six.moves import xrange


def labels_from_probs(probs):
Expand Down Expand Up @@ -127,5 +128,3 @@ def aggregation_most_frequent(logits):
result[i] = np.argmax(label_counts)

return np.asarray(result, dtype=np.int32)


3 changes: 1 addition & 2 deletions research/differential_privacy/multiple_teachers/deep_cnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from datetime import datetime
import math
import numpy as np
from six.moves import xrange
import tensorflow as tf
import time

Expand Down Expand Up @@ -600,5 +601,3 @@ def softmax_preds(images, ckpt_path, return_logits=False):
tf.reset_default_graph()

return preds


1 change: 1 addition & 0 deletions research/differential_privacy/multiple_teachers/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import os
from scipy.io import loadmat as loadmat
from six.moves import urllib
from six.moves import xrange
import sys
import tarfile

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from __future__ import print_function

import numpy as np
from six.moves import xrange
import tensorflow as tf

from differential_privacy.multiple_teachers import aggregation
Expand Down
1 change: 1 addition & 0 deletions research/domain_adaptation/domain_separation/dsn_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import math

import numpy as np
from six.moves import xrange
import tensorflow as tf

from domain_adaptation.datasets import dataset_factory
Expand Down
1 change: 1 addition & 0 deletions research/gan/cifar/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from __future__ import division
from __future__ import print_function

from six.moves import xrange
import tensorflow as tf
tfgan = tf.contrib.gan

Expand Down
1 change: 1 addition & 0 deletions research/gan/image_compression/networks_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from __future__ import print_function

import tensorflow as tf
from six.moves import xrange
import networks


Expand Down
1 change: 1 addition & 0 deletions research/gan/mnist/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@


import numpy as np
from six.moves import xrange
import tensorflow as tf

ds = tf.contrib.distributions
Expand Down
1 change: 1 addition & 0 deletions research/gan/mnist_estimator/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import numpy as np
import scipy.misc
from six.moves import xrange
import tensorflow as tf

from mnist import data_provider
Expand Down
1 change: 1 addition & 0 deletions research/im2txt/im2txt/data/build_mscoco_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@

import nltk.tokenize
import numpy as np
from six.moves import xrange
import tensorflow as tf

tf.flags.DEFINE_string("train_image_dir", "/tmp/train2014/",
Expand Down
1 change: 1 addition & 0 deletions research/learned_optimizer/metaopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import time

import numpy as np
from six.moves import xrange
import tensorflow as tf

from learned_optimizer.optimizer import trainable_optimizer
Expand Down
1 change: 1 addition & 0 deletions research/learning_to_remember_rare_events/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from scipy.misc import imresize
from scipy.misc import imrotate
from scipy.ndimage import imread
from six.moves import xrange
import tensorflow as tf


Expand Down
1 change: 1 addition & 0 deletions research/learning_to_remember_rare_events/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"""

import numpy as np
from six.moves import xrange
import tensorflow as tf


Expand Down
1 change: 1 addition & 0 deletions research/learning_to_remember_rare_events/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import random

import numpy as np
from six.moves import xrange
import tensorflow as tf

import data_utils
Expand Down
9 changes: 5 additions & 4 deletions research/lfads/synth_data/generate_itb_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import h5py
import numpy as np
import os
from six.moves import xrange
import tensorflow as tf

from utils import write_datasets
Expand Down Expand Up @@ -47,12 +48,12 @@
flags.DEFINE_float("u_std", 0.25,
"Std dev of input to integration to bound model")
flags.DEFINE_string("checkpoint_path", "SAMPLE_CHECKPOINT",
"""Path to directory with checkpoints of model
"""Path to directory with checkpoints of model
trained on integration to bound task. Currently this
is a placeholder which tells the code to grab the
checkpoint that is provided with the code
(in /trained_itb/..). If you have your own checkpoint
you would like to restore, you would point it to
checkpoint that is provided with the code
(in /trained_itb/..). If you have your own checkpoint
you would like to restore, you would point it to
that path.""")
FLAGS = flags.FLAGS

Expand Down
1 change: 1 addition & 0 deletions research/lfads/synth_data/generate_labeled_rnn_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import os
import h5py
import numpy as np
from six.moves import xrange

from synthetic_data_utils import generate_data, generate_rnn
from synthetic_data_utils import get_train_n_valid_inds
Expand Down
1 change: 1 addition & 0 deletions research/neural_gpu/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import time

import numpy as np
from six.moves import xrange
import tensorflow as tf

import program_utils
Expand Down
1 change: 1 addition & 0 deletions research/next_frame_prediction/cross_conv/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import time

import numpy as np
from six.moves import xrange
import tensorflow as tf

import model as cross_conv_model
Expand Down
1 change: 1 addition & 0 deletions research/next_frame_prediction/cross_conv/example_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import sys

import numpy as np
from six.moves import xrange
import tensorflow as tf


Expand Down
1 change: 1 addition & 0 deletions research/next_frame_prediction/cross_conv/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import math
import sys

from six.moves import xrange
import tensorflow as tf

slim = tf.contrib.slim
Expand Down
1 change: 1 addition & 0 deletions research/next_frame_prediction/cross_conv/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

"""Read image sequence."""

from six.moves import xrange
import tensorflow as tf


Expand Down
1 change: 1 addition & 0 deletions research/next_frame_prediction/cross_conv/sprites_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import numpy as np
import scipy.misc
from six.moves import xrange
import tensorflow as tf


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from __future__ import division
from __future__ import print_function

from six.moves import xrange
import tensorflow as tf

from object_detection.core import standard_fields
Expand Down
Loading

0 comments on commit d90d528

Please sign in to comment.