Unverified Commit d90d5280 authored by Neal Wu's avatar Neal Wu Committed by GitHub
Browse files

Merge pull request #3206 from cclauss/from-six.moves-import-xrange

from six.moves import xrange (en masse)
parents 6fc65ee6 848cc592
...@@ -10,6 +10,7 @@ else that may be specific to a particular run. ...@@ -10,6 +10,7 @@ else that may be specific to a particular run.
import ast import ast
import itertools import itertools
from six.moves import xrange
class Config(dict): class Config(dict):
......
...@@ -7,6 +7,7 @@ from __future__ import print_function ...@@ -7,6 +7,7 @@ from __future__ import print_function
from math import exp from math import exp
from math import sqrt from math import sqrt
import numpy as np import numpy as np
from six.moves import xrange
import tensorflow as tf import tensorflow as tf
from common import config_lib # brain coder from common import config_lib # brain coder
......
...@@ -12,6 +12,7 @@ import random ...@@ -12,6 +12,7 @@ import random
from absl import logging from absl import logging
import numpy as np import numpy as np
from six.moves import xrange
import tensorflow as tf import tensorflow as tf
......
...@@ -11,6 +11,7 @@ import random ...@@ -11,6 +11,7 @@ import random
from absl import logging from absl import logging
import numpy as np import numpy as np
from six.moves import xrange
from common import bf # brain coder from common import bf # brain coder
from common import reward as r # brain coder from common import reward as r # brain coder
......
...@@ -14,6 +14,7 @@ import random ...@@ -14,6 +14,7 @@ import random
from absl import flags from absl import flags
from absl import logging from absl import logging
import numpy as np import numpy as np
from six.moves import xrange
from common import bf # brain coder from common import bf # brain coder
from common import utils # brain coder from common import utils # brain coder
...@@ -469,4 +470,3 @@ class Individual(list): ...@@ -469,4 +470,3 @@ class Individual(list):
def random_individual(genome_size): def random_individual(genome_size):
return lambda: Individual(np.random.choice(GENES, genome_size).tolist()) return lambda: Individual(np.random.choice(GENES, genome_size).tolist())
...@@ -18,6 +18,7 @@ from time import sleep ...@@ -18,6 +18,7 @@ from time import sleep
from absl import flags from absl import flags
from absl import logging from absl import logging
import numpy as np import numpy as np
from six.moves import xrange
import tensorflow as tf import tensorflow as tf
from common import utils # brain coder from common import utils # brain coder
...@@ -321,4 +322,3 @@ def run_random_search(max_num_programs, checkpoint_dir, task_eval_fn, ...@@ -321,4 +322,3 @@ def run_random_search(max_num_programs, checkpoint_dir, task_eval_fn,
solution_found=found_solution, generations=num_programs_seen, solution_found=found_solution, generations=num_programs_seen,
num_programs=num_programs_seen, max_generations=max_num_programs, num_programs=num_programs_seen, max_generations=max_num_programs,
max_num_programs=max_num_programs) max_num_programs=max_num_programs)
...@@ -15,6 +15,7 @@ import time ...@@ -15,6 +15,7 @@ import time
from absl import logging from absl import logging
import numpy as np import numpy as np
from six.moves import xrange
import tensorflow as tf import tensorflow as tf
from common import rollout as rollout_lib # brain coder from common import rollout as rollout_lib # brain coder
...@@ -1294,4 +1295,3 @@ def process_episodes( ...@@ -1294,4 +1295,3 @@ def process_episodes(
batch_targets = np.array([], dtype=np.float32) batch_targets = np.array([], dtype=np.float32)
return (batch_targets, batch_returns) return (batch_targets, batch_returns)
...@@ -8,6 +8,7 @@ from collections import Counter ...@@ -8,6 +8,7 @@ from collections import Counter
from absl import logging from absl import logging
import numpy as np import numpy as np
from six.moves import xrange
import tensorflow as tf import tensorflow as tf
from common import utils # brain coder from common import utils # brain coder
......
...@@ -8,6 +8,7 @@ import ast ...@@ -8,6 +8,7 @@ import ast
from collections import namedtuple from collections import namedtuple
import os import os
import re import re
from six.moves import xrange
import tensorflow as tf import tensorflow as tf
...@@ -152,4 +153,3 @@ class Results(object): ...@@ -152,4 +153,3 @@ class Results(object):
r for shard_results in results_per_shard for r in shard_results] r for shard_results in results_per_shard for r in shard_results]
return aggregate, shard_stats return aggregate, shard_stats
...@@ -8,6 +8,7 @@ import contextlib ...@@ -8,6 +8,7 @@ import contextlib
import os import os
import shutil import shutil
import tempfile import tempfile
from six.moves import xrange
import tensorflow as tf import tensorflow as tf
from single_task import results_lib # brain coder from single_task import results_lib # brain coder
......
...@@ -4,6 +4,7 @@ from __future__ import print_function ...@@ -4,6 +4,7 @@ from __future__ import print_function
"""Tasks that test correctness of algorithms.""" """Tasks that test correctness of algorithms."""
from six.moves import xrange
from common import reward as reward_lib # brain coder from common import reward as reward_lib # brain coder
from single_task import misc # brain coder from single_task import misc # brain coder
...@@ -124,5 +125,3 @@ class HillClimbingTask(object): ...@@ -124,5 +125,3 @@ class HillClimbingTask(object):
# closest next element. # closest next element.
# Maximum distance possible is num_actions * base / 2 = 3 * 8 / 2 = 12 # Maximum distance possible is num_actions * base / 2 = 3 * 8 / 2 = 12
return (len(prefix) + (1 - min_dist / 12.0)), False return (len(prefix) + (1 - min_dist / 12.0)), False
...@@ -39,6 +39,7 @@ from absl import app ...@@ -39,6 +39,7 @@ from absl import app
from absl import flags from absl import flags
from absl import logging from absl import logging
import numpy as np import numpy as np
from six.moves import xrange
import tensorflow as tf import tensorflow as tf
from single_task import defaults # brain coder from single_task import defaults # brain coder
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
import os import os
import numpy as np import numpy as np
from six.moves import xrange
import tensorflow as tf import tensorflow as tf
import synthetic_model import synthetic_model
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
"""Binary code sample generator.""" """Binary code sample generator."""
import numpy as np import numpy as np
from six.moves import xrange
_CRC_LINE = [ _CRC_LINE = [
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
"""Define some typical masked 2D convolutions.""" """Define some typical masked 2D convolutions."""
import numpy as np import numpy as np
from six.moves import xrange
import tensorflow as tf import tensorflow as tf
import block_util import block_util
......
...@@ -19,6 +19,7 @@ from __future__ import division ...@@ -19,6 +19,7 @@ from __future__ import division
from __future__ import unicode_literals from __future__ import unicode_literals
import numpy as np import numpy as np
from six.moves import xrange
import tensorflow as tf import tensorflow as tf
import blocks_masked_conv2d import blocks_masked_conv2d
......
...@@ -22,6 +22,7 @@ import math ...@@ -22,6 +22,7 @@ import math
import os import os
import numpy as np import numpy as np
from six.moves import xrange
import tensorflow as tf import tensorflow as tf
import blocks_std import blocks_std
......
...@@ -25,6 +25,7 @@ from __future__ import print_function ...@@ -25,6 +25,7 @@ from __future__ import print_function
from delf import feature_pb2 from delf import feature_pb2
from delf import datum_io from delf import datum_io
import numpy as np import numpy as np
from six.moves import xrange
import tensorflow as tf import tensorflow as tf
......
...@@ -22,6 +22,7 @@ import sys ...@@ -22,6 +22,7 @@ import sys
import time import time
import numpy as np import numpy as np
from six.moves import xrange
import tensorflow as tf import tensorflow as tf
from differential_privacy.dp_sgd.dp_optimizer import dp_optimizer from differential_privacy.dp_sgd.dp_optimizer import dp_optimizer
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
import collections import collections
from six.moves import xrange
import tensorflow as tf import tensorflow as tf
OrderedDict = collections.OrderedDict OrderedDict = collections.OrderedDict
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment