From d18531cc6ae5f87bde44061cefc255ac2273fce5 Mon Sep 17 00:00:00 2001 From: Rodrigo Queiro Date: Wed, 19 Feb 2020 17:35:48 +0100 Subject: [PATCH] Replace tensorflow with tf.compat.v1 This means they won't break when using TensorFlow 2.0. --- examples/pybullet/gym/pybullet_envs/agents/configs.py | 2 +- examples/pybullet/gym/pybullet_envs/agents/networks.py | 2 +- examples/pybullet/gym/pybullet_envs/agents/ppo/algorithm.py | 2 +- examples/pybullet/gym/pybullet_envs/agents/ppo/memory.py | 2 +- examples/pybullet/gym/pybullet_envs/agents/ppo/normalize.py | 2 +- examples/pybullet/gym/pybullet_envs/agents/ppo/utility.py | 2 +- .../pybullet/gym/pybullet_envs/agents/tools/count_weights.py | 2 +- .../gym/pybullet_envs/agents/tools/in_graph_batch_env.py | 2 +- .../pybullet/gym/pybullet_envs/agents/tools/in_graph_env.py | 2 +- examples/pybullet/gym/pybullet_envs/agents/tools/loop.py | 2 +- .../pybullet/gym/pybullet_envs/agents/tools/mock_algorithm.py | 2 +- examples/pybullet/gym/pybullet_envs/agents/tools/simulate.py | 2 +- .../pybullet/gym/pybullet_envs/agents/tools/streaming_mean.py | 2 +- examples/pybullet/gym/pybullet_envs/agents/tools/wrappers.py | 2 +- examples/pybullet/gym/pybullet_envs/agents/train_ppo.py | 2 +- examples/pybullet/gym/pybullet_envs/agents/utility.py | 2 +- examples/pybullet/gym/pybullet_envs/agents/visualize_ppo.py | 2 +- .../deep_mimic/learning/nets/fc_2layers_1024units.py | 2 +- .../pybullet/gym/pybullet_envs/deep_mimic/learning/pg_agent.py | 2 +- .../pybullet/gym/pybullet_envs/deep_mimic/learning/ppo_agent.py | 2 +- .../gym/pybullet_envs/deep_mimic/learning/solvers/mpi_solver.py | 2 +- .../pybullet/gym/pybullet_envs/deep_mimic/learning/tf_agent.py | 2 +- .../gym/pybullet_envs/deep_mimic/learning/tf_normalizer.py | 2 +- .../pybullet/gym/pybullet_envs/deep_mimic/learning/tf_util.py | 2 +- .../minitaur/actuatornet/minitaur_raibert_controller_example.py | 2 +- .../gym/pybullet_envs/minitaur/actuatornet/proto2csv.py | 2 +- .../pybullet/gym/pybullet_envs/minitaur/agents/ppo/algorithm.py | 2 +- .../pybullet/gym/pybullet_envs/minitaur/agents/ppo/memory.py | 2 +- .../pybullet/gym/pybullet_envs/minitaur/agents/ppo/normalize.py | 2 +- .../pybullet/gym/pybullet_envs/minitaur/agents/ppo/utility.py | 2 +- .../gym/pybullet_envs/minitaur/agents/scripts/networks.py | 2 +- .../pybullet/gym/pybullet_envs/minitaur/agents/scripts/train.py | 2 +- .../gym/pybullet_envs/minitaur/agents/scripts/train_ppo_test.py | 2 +- .../gym/pybullet_envs/minitaur/agents/scripts/utility.py | 2 +- .../gym/pybullet_envs/minitaur/agents/scripts/visualize.py | 2 +- .../gym/pybullet_envs/minitaur/agents/tools/attr_dict_test.py | 2 +- .../gym/pybullet_envs/minitaur/agents/tools/count_weights.py | 2 +- .../pybullet_envs/minitaur/agents/tools/count_weights_test.py | 2 +- .../pybullet_envs/minitaur/agents/tools/in_graph_batch_env.py | 2 +- .../gym/pybullet_envs/minitaur/agents/tools/in_graph_env.py | 2 +- .../pybullet/gym/pybullet_envs/minitaur/agents/tools/loop.py | 2 +- .../gym/pybullet_envs/minitaur/agents/tools/loop_test.py | 2 +- .../gym/pybullet_envs/minitaur/agents/tools/mock_algorithm.py | 2 +- .../gym/pybullet_envs/minitaur/agents/tools/simulate.py | 2 +- .../gym/pybullet_envs/minitaur/agents/tools/simulate_test.py | 2 +- .../gym/pybullet_envs/minitaur/agents/tools/streaming_mean.py | 2 +- .../gym/pybullet_envs/minitaur/agents/tools/wrappers.py | 2 +- .../gym/pybullet_envs/minitaur/agents/tools/wrappers_test.py | 2 +- .../env_randomizers/minitaur_alternating_legs_env_randomizer.py | 2 +- .../envs/env_randomizers/minitaur_env_randomizer_from_config.py | 2 +- .../minitaur/envs/minitaur_alternating_legs_env_example.py | 2 +- .../minitaur/envs/minitaur_ball_gym_env_example.py | 2 +- .../minitaur/envs/minitaur_four_leg_stand_env_example.py | 2 +- .../gym/pybullet_envs/minitaur/envs/minitaur_gym_env_example.py | 2 +- .../gym/pybullet_envs/minitaur/envs/minitaur_logging.py | 2 +- .../minitaur/envs/minitaur_raibert_controller_example.py | 2 +- .../minitaur/envs/minitaur_randomize_terrain_gym_env_example.py | 2 +- .../minitaur/envs/minitaur_reactive_env_example.py | 2 +- .../minitaur/envs/minitaur_stand_gym_env_example.py | 2 +- .../minitaur/envs/minitaur_trotting_env_example.py | 2 +- .../gym/pybullet_envs/minitaur/envs/simple_ppo_agent.py | 2 +- .../gym/pybullet_envs/minitaur/envs/simple_ppo_agent_example.py | 2 +- examples/pybullet/gym/pybullet_utils/util.py | 2 +- examples/pybullet/tensorflow/humanoid_running.py | 2 +- examples/pybullet/tensorflow/humanoid_running_vr_follow.py | 2 +- 65 files changed, 65 insertions(+), 65 deletions(-) diff --git a/examples/pybullet/gym/pybullet_envs/agents/configs.py b/examples/pybullet/gym/pybullet_envs/agents/configs.py index 992d226ef..29efac60e 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/configs.py +++ b/examples/pybullet/gym/pybullet_envs/agents/configs.py @@ -26,7 +26,7 @@ from pybullet_envs.bullet import minitaur_duck_gym_env from pybullet_envs.bullet import minitaur_env_randomizer import pybullet_envs.bullet.minitaur_gym_env as minitaur_gym_env import pybullet_envs -import tensorflow as tf +import tf.compat.v1 as tf def default(): diff --git a/examples/pybullet/gym/pybullet_envs/agents/networks.py b/examples/pybullet/gym/pybullet_envs/agents/networks.py index 3b6802d02..203a4a80c 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/networks.py +++ b/examples/pybullet/gym/pybullet_envs/agents/networks.py @@ -21,7 +21,7 @@ import collections import functools import operator -import tensorflow as tf +import tf.compat.v1 as tf NetworkOutput = collections.namedtuple('NetworkOutput', 'policy, mean, logstd, value, state') diff --git a/examples/pybullet/gym/pybullet_envs/agents/ppo/algorithm.py b/examples/pybullet/gym/pybullet_envs/agents/ppo/algorithm.py index c6921095f..dd18a7c5c 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/ppo/algorithm.py +++ b/examples/pybullet/gym/pybullet_envs/agents/ppo/algorithm.py @@ -23,7 +23,7 @@ from __future__ import print_function import functools -import tensorflow as tf +import tf.compat.v1 as tf from . import memory from . import normalize diff --git a/examples/pybullet/gym/pybullet_envs/agents/ppo/memory.py b/examples/pybullet/gym/pybullet_envs/agents/ppo/memory.py index eee19ac07..a1de8cd0f 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/ppo/memory.py +++ b/examples/pybullet/gym/pybullet_envs/agents/ppo/memory.py @@ -17,7 +17,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tf.compat.v1 as tf class EpisodeMemory(object): diff --git a/examples/pybullet/gym/pybullet_envs/agents/ppo/normalize.py b/examples/pybullet/gym/pybullet_envs/agents/ppo/normalize.py index 4de38fd25..1b86cd083 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/ppo/normalize.py +++ b/examples/pybullet/gym/pybullet_envs/agents/ppo/normalize.py @@ -17,7 +17,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tf.compat.v1 as tf class StreamingNormalize(object): diff --git a/examples/pybullet/gym/pybullet_envs/agents/ppo/utility.py b/examples/pybullet/gym/pybullet_envs/agents/ppo/utility.py index 29d9bf9ea..f0323fd21 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/ppo/utility.py +++ b/examples/pybullet/gym/pybullet_envs/agents/ppo/utility.py @@ -21,7 +21,7 @@ import collections import math import re -import tensorflow as tf +import tf.compat.v1 as tf from tensorflow.python.client import device_lib diff --git a/examples/pybullet/gym/pybullet_envs/agents/tools/count_weights.py b/examples/pybullet/gym/pybullet_envs/agents/tools/count_weights.py index 279df82a0..610ded427 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/tools/count_weights.py +++ b/examples/pybullet/gym/pybullet_envs/agents/tools/count_weights.py @@ -20,7 +20,7 @@ from __future__ import print_function import re import numpy as np -import tensorflow as tf +import tf.compat.v1 as tf def count_weights(scope=None, exclude=None, graph=None): diff --git a/examples/pybullet/gym/pybullet_envs/agents/tools/in_graph_batch_env.py b/examples/pybullet/gym/pybullet_envs/agents/tools/in_graph_batch_env.py index a4709f0a5..7eadf3422 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/tools/in_graph_batch_env.py +++ b/examples/pybullet/gym/pybullet_envs/agents/tools/in_graph_batch_env.py @@ -18,7 +18,7 @@ from __future__ import division from __future__ import print_function import gym -import tensorflow as tf +import tf.compat.v1 as tf class InGraphBatchEnv(object): diff --git a/examples/pybullet/gym/pybullet_envs/agents/tools/in_graph_env.py b/examples/pybullet/gym/pybullet_envs/agents/tools/in_graph_env.py index 6a71f4516..7f78a9e32 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/tools/in_graph_env.py +++ b/examples/pybullet/gym/pybullet_envs/agents/tools/in_graph_env.py @@ -18,7 +18,7 @@ from __future__ import division from __future__ import print_function import gym -import tensorflow as tf +import tf.compat.v1 as tf class InGraphEnv(object): diff --git a/examples/pybullet/gym/pybullet_envs/agents/tools/loop.py b/examples/pybullet/gym/pybullet_envs/agents/tools/loop.py index b70798c18..3f845de53 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/tools/loop.py +++ b/examples/pybullet/gym/pybullet_envs/agents/tools/loop.py @@ -20,7 +20,7 @@ from __future__ import print_function import collections import os -import tensorflow as tf +import tf.compat.v1 as tf from . import streaming_mean diff --git a/examples/pybullet/gym/pybullet_envs/agents/tools/mock_algorithm.py b/examples/pybullet/gym/pybullet_envs/agents/tools/mock_algorithm.py index c9c55ac60..0faa172ae 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/tools/mock_algorithm.py +++ b/examples/pybullet/gym/pybullet_envs/agents/tools/mock_algorithm.py @@ -17,7 +17,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tf.compat.v1 as tf class MockAlgorithm(object): diff --git a/examples/pybullet/gym/pybullet_envs/agents/tools/simulate.py b/examples/pybullet/gym/pybullet_envs/agents/tools/simulate.py index 128b83f00..ba59d32b6 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/tools/simulate.py +++ b/examples/pybullet/gym/pybullet_envs/agents/tools/simulate.py @@ -17,7 +17,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tf.compat.v1 as tf from . import streaming_mean diff --git a/examples/pybullet/gym/pybullet_envs/agents/tools/streaming_mean.py b/examples/pybullet/gym/pybullet_envs/agents/tools/streaming_mean.py index 5992eaa6b..8a27b484a 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/tools/streaming_mean.py +++ b/examples/pybullet/gym/pybullet_envs/agents/tools/streaming_mean.py @@ -17,7 +17,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tf.compat.v1 as tf class StreamingMean(object): diff --git a/examples/pybullet/gym/pybullet_envs/agents/tools/wrappers.py b/examples/pybullet/gym/pybullet_envs/agents/tools/wrappers.py index 0c3ff47b6..8684583fe 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/tools/wrappers.py +++ b/examples/pybullet/gym/pybullet_envs/agents/tools/wrappers.py @@ -25,7 +25,7 @@ import traceback import gym import gym.spaces import numpy as np -import tensorflow as tf +import tf.compat.v1 as tf class AutoReset(object): diff --git a/examples/pybullet/gym/pybullet_envs/agents/train_ppo.py b/examples/pybullet/gym/pybullet_envs/agents/train_ppo.py index aa41634a2..5a45e2a4c 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/train_ppo.py +++ b/examples/pybullet/gym/pybullet_envs/agents/train_ppo.py @@ -26,7 +26,7 @@ import datetime import os import gym -import tensorflow as tf +import tf.compat.v1 as tf from . import tools from . import configs diff --git a/examples/pybullet/gym/pybullet_envs/agents/utility.py b/examples/pybullet/gym/pybullet_envs/agents/utility.py index 1ccebbd10..d2a4ee385 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/utility.py +++ b/examples/pybullet/gym/pybullet_envs/agents/utility.py @@ -22,7 +22,7 @@ import os import re import ruamel.yaml as yaml -import tensorflow as tf +import tf.compat.v1 as tf from . import tools diff --git a/examples/pybullet/gym/pybullet_envs/agents/visualize_ppo.py b/examples/pybullet/gym/pybullet_envs/agents/visualize_ppo.py index 141f93c8f..2178b8c01 100644 --- a/examples/pybullet/gym/pybullet_envs/agents/visualize_ppo.py +++ b/examples/pybullet/gym/pybullet_envs/agents/visualize_ppo.py @@ -27,7 +27,7 @@ import os import gym from gym import wrappers -import tensorflow as tf +import tf.compat.v1 as tf from . import tools from . import utility diff --git a/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/nets/fc_2layers_1024units.py b/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/nets/fc_2layers_1024units.py index a0f627639..59df884d5 100644 --- a/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/nets/fc_2layers_1024units.py +++ b/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/nets/fc_2layers_1024units.py @@ -1,4 +1,4 @@ -import tensorflow as tf +import tf.compat.v1 as tf import pybullet_envs.deep_mimic.learning.tf_util as TFUtil NAME = "fc_2layers_1024units" diff --git a/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/pg_agent.py b/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/pg_agent.py index 2787e2356..a9c623678 100644 --- a/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/pg_agent.py +++ b/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/pg_agent.py @@ -1,5 +1,5 @@ import numpy as np -import tensorflow as tf +import tf.compat.v1 as tf import copy from pybullet_envs.deep_mimic.learning.tf_agent import TFAgent diff --git a/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/ppo_agent.py b/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/ppo_agent.py index 125a1bb38..15c93224e 100644 --- a/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/ppo_agent.py +++ b/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/ppo_agent.py @@ -1,6 +1,6 @@ import numpy as np import copy as copy -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.deep_mimic.learning.pg_agent import PGAgent from pybullet_envs.deep_mimic.learning.solvers.mpi_solver import MPISolver diff --git a/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/solvers/mpi_solver.py b/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/solvers/mpi_solver.py index 0077f4b11..c3022f92d 100644 --- a/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/solvers/mpi_solver.py +++ b/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/solvers/mpi_solver.py @@ -1,5 +1,5 @@ from mpi4py import MPI -import tensorflow as tf +import tf.compat.v1 as tf import numpy as np import pybullet_envs.deep_mimic.learning.tf_util as TFUtil import pybullet_utils.math_util as MathUtil diff --git a/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/tf_agent.py b/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/tf_agent.py index 1770e5329..185c0e67a 100644 --- a/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/tf_agent.py +++ b/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/tf_agent.py @@ -1,5 +1,5 @@ import numpy as np -import tensorflow as tf +import tf.compat.v1 as tf from abc import abstractmethod from pybullet_envs.deep_mimic.learning.rl_agent import RLAgent diff --git a/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/tf_normalizer.py b/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/tf_normalizer.py index 907eec85b..d13371069 100644 --- a/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/tf_normalizer.py +++ b/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/tf_normalizer.py @@ -1,6 +1,6 @@ import numpy as np import copy -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.deep_mimic.learning.normalizer import Normalizer diff --git a/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/tf_util.py b/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/tf_util.py index 043d8dcd9..859eefab2 100644 --- a/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/tf_util.py +++ b/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/tf_util.py @@ -1,4 +1,4 @@ -import tensorflow as tf +import tf.compat.v1 as tf import numpy as np import os diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/actuatornet/minitaur_raibert_controller_example.py b/examples/pybullet/gym/pybullet_envs/minitaur/actuatornet/minitaur_raibert_controller_example.py index 40e6b4799..39108d003 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/actuatornet/minitaur_raibert_controller_example.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/actuatornet/minitaur_raibert_controller_example.py @@ -6,7 +6,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.minitaur.envs import minitaur_raibert_controller from pybullet_envs.minitaur.envs import minitaur_gym_env diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/actuatornet/proto2csv.py b/examples/pybullet/gym/pybullet_envs/minitaur/actuatornet/proto2csv.py index 2e04313e8..08c25524d 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/actuatornet/proto2csv.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/actuatornet/proto2csv.py @@ -5,7 +5,7 @@ from __future__ import print_function #python proto2csv.py --proto_file=/tmp/logs/minitaur_log_2019-01-27-12-59-31 --csv_file=/tmp/logs/out.csv #each line in csv contains: angle, velocity, action, torque -import tensorflow as tf +import tf.compat.v1 as tf import argparse import numpy from pybullet_envs.minitaur.envs import minitaur_logging diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/algorithm.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/algorithm.py index 032eac760..aef0c1c8c 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/algorithm.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/algorithm.py @@ -23,7 +23,7 @@ from __future__ import print_function import collections -import tensorflow as tf +import tf.compat.v1 as tf from . import memory from . import normalize diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/memory.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/memory.py index 37a7c7f53..54bd2a618 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/memory.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/memory.py @@ -17,7 +17,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tf.compat.v1 as tf class EpisodeMemory(object): diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/normalize.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/normalize.py index 4de38fd25..1b86cd083 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/normalize.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/normalize.py @@ -17,7 +17,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tf.compat.v1 as tf class StreamingNormalize(object): diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/utility.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/utility.py index 9f6360404..9fc18e0f6 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/utility.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/ppo/utility.py @@ -21,7 +21,7 @@ import collections import math import re -import tensorflow as tf +import tf.compat.v1 as tf from tensorflow.python.client import device_lib diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/networks.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/networks.py index d2c22bd0f..064346b38 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/networks.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/networks.py @@ -17,7 +17,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tf.compat.v1 as tf _MEAN_WEIGHTS_INITIALIZER = tf.contrib.layers.variance_scaling_initializer(factor=0.1) _LOGSTD_INITIALIZER = tf.random_normal_initializer(-1, 1e-10) diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/train.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/train.py index 99495b362..5b0f729e9 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/train.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/train.py @@ -27,7 +27,7 @@ import functools import os import gym -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.minitaur.agents import tools from pybullet_envs.minitaur.agents.scripts import configs diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/train_ppo_test.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/train_ppo_test.py index 930143c39..1d3cc3e3a 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/train_ppo_test.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/train_ppo_test.py @@ -20,7 +20,7 @@ from __future__ import print_function import functools import itertools -import tensorflow as tf +import tf.compat.v1 as tf from google3.robotics.reinforcement_learning.agents import ppo from google3.robotics.reinforcement_learning.agents import tools diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/utility.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/utility.py index 22bc50126..e30e38be2 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/utility.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/utility.py @@ -22,7 +22,7 @@ import os import re import ruamel.yaml as yaml -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.minitaur.agents import tools diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/visualize.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/visualize.py index cc68c0d42..a05fc7ac6 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/visualize.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/visualize.py @@ -27,7 +27,7 @@ import functools import os import gym -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.minitaur.agents import tools from pybullet_envs.minitaur.agents.scripts import utility diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/attr_dict_test.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/attr_dict_test.py index 7ab1f415f..14b0150d3 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/attr_dict_test.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/attr_dict_test.py @@ -17,7 +17,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.minitaur.agents.tools import attr_dict diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/count_weights.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/count_weights.py index 279df82a0..610ded427 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/count_weights.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/count_weights.py @@ -20,7 +20,7 @@ from __future__ import print_function import re import numpy as np -import tensorflow as tf +import tf.compat.v1 as tf def count_weights(scope=None, exclude=None, graph=None): diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/count_weights_test.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/count_weights_test.py index a42c60f57..d5a1a4448 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/count_weights_test.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/count_weights_test.py @@ -17,7 +17,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tf.compat.v1 as tf from agents.tools import count_weights diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/in_graph_batch_env.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/in_graph_batch_env.py index 6cd0a2fdf..f3f7e22c1 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/in_graph_batch_env.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/in_graph_batch_env.py @@ -18,7 +18,7 @@ from __future__ import division from __future__ import print_function import pdb import gym -import tensorflow as tf +import tf.compat.v1 as tf class InGraphBatchEnv(object): diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/in_graph_env.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/in_graph_env.py index 6a71f4516..7f78a9e32 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/in_graph_env.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/in_graph_env.py @@ -18,7 +18,7 @@ from __future__ import division from __future__ import print_function import gym -import tensorflow as tf +import tf.compat.v1 as tf class InGraphEnv(object): diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/loop.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/loop.py index 78a3cfd29..05a9a8cea 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/loop.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/loop.py @@ -20,7 +20,7 @@ from __future__ import print_function import collections import os -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.minitaur.agents.tools import streaming_mean diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/loop_test.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/loop_test.py index 3245d26b7..112cda81d 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/loop_test.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/loop_test.py @@ -17,7 +17,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tf.compat.v1 as tf from google3.robotics.reinforcement_learning.agents import tools diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/mock_algorithm.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/mock_algorithm.py index e321afae3..60b88adc3 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/mock_algorithm.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/mock_algorithm.py @@ -17,7 +17,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tf.compat.v1 as tf class MockAlgorithm(object): diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/simulate.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/simulate.py index e794f6a9d..12254605e 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/simulate.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/simulate.py @@ -17,7 +17,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.minitaur.agents.tools import streaming_mean diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/simulate_test.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/simulate_test.py index 42b45bc7f..c53c0babf 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/simulate_test.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/simulate_test.py @@ -17,7 +17,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tf.compat.v1 as tf from google3.robotics.reinforcement_learning.agents import tools diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/streaming_mean.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/streaming_mean.py index 5992eaa6b..8a27b484a 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/streaming_mean.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/streaming_mean.py @@ -17,7 +17,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tf.compat.v1 as tf class StreamingMean(object): diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/wrappers.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/wrappers.py index 2e33f3942..829c48a97 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/wrappers.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/wrappers.py @@ -26,7 +26,7 @@ import traceback import gym import gym.spaces import numpy as np -import tensorflow as tf +import tf.compat.v1 as tf class AutoReset(object): diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/wrappers_test.py b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/wrappers_test.py index fac8dd0d4..76cf31684 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/wrappers_test.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/agents/tools/wrappers_test.py @@ -19,7 +19,7 @@ from __future__ import print_function import functools -import tensorflow as tf +import tf.compat.v1 as tf from agents import tools diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/envs/env_randomizers/minitaur_alternating_legs_env_randomizer.py b/examples/pybullet/gym/pybullet_envs/minitaur/envs/env_randomizers/minitaur_alternating_legs_env_randomizer.py index 9f868ba60..c72c87715 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/envs/env_randomizers/minitaur_alternating_legs_env_randomizer.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/envs/env_randomizers/minitaur_alternating_legs_env_randomizer.py @@ -11,7 +11,7 @@ parentdir = os.path.dirname(os.path.dirname(parentdir)) os.sys.path.insert(0, parentdir) import numpy as np -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.minitaur.envs import env_randomizer_base # Absolute range. diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/envs/env_randomizers/minitaur_env_randomizer_from_config.py b/examples/pybullet/gym/pybullet_envs/minitaur/envs/env_randomizers/minitaur_env_randomizer_from_config.py index a550f35a0..8254d0ca7 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/envs/env_randomizers/minitaur_env_randomizer_from_config.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/envs/env_randomizers/minitaur_env_randomizer_from_config.py @@ -14,7 +14,7 @@ parentdir = os.path.dirname(os.path.dirname(parentdir)) os.sys.path.insert(0, parentdir) import numpy as np -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.minitaur.envs import env_randomizer_base from pybullet_envs.minitaur.envs.env_randomizers import minitaur_env_randomizer_config diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_alternating_legs_env_example.py b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_alternating_legs_env_example.py index 226edf3c5..da308e2fe 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_alternating_legs_env_example.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_alternating_legs_env_example.py @@ -10,7 +10,7 @@ os.sys.path.insert(0, parentdir) import os import numpy as np -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.minitaur.envs import minitaur_alternating_legs_env from pybullet_envs.minitaur.envs import minitaur_gym_env from pybullet_envs.minitaur.envs.env_randomizers import minitaur_alternating_legs_env_randomizer as randomizer_lib diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_ball_gym_env_example.py b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_ball_gym_env_example.py index 404dc26ac..b0d7d4807 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_ball_gym_env_example.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_ball_gym_env_example.py @@ -4,7 +4,7 @@ import math -import tensorflow as tf +import tf.compat.v1 as tf import minitaur_ball_gym_env diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_four_leg_stand_env_example.py b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_four_leg_stand_env_example.py index 183213fce..d4d92fd56 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_four_leg_stand_env_example.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_four_leg_stand_env_example.py @@ -2,7 +2,7 @@ """ import numpy as np -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.minitaur.envs import minitaur_four_leg_stand_env FLAGS = tf.flags.FLAGS diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_gym_env_example.py b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_gym_env_example.py index 8441879ad..9511b7280 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_gym_env_example.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_gym_env_example.py @@ -13,7 +13,7 @@ os.sys.path.insert(0, parentdir) import argparse import numpy as np -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.minitaur.envs import minitaur_gym_env import time diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_logging.py b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_logging.py index e8467a5ae..500bbdc71 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_logging.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_logging.py @@ -19,7 +19,7 @@ import datetime import os import time -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.minitaur.envs import minitaur_logging_pb2 NUM_MOTORS = 8 diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_raibert_controller_example.py b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_raibert_controller_example.py index 8adeee376..301f03569 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_raibert_controller_example.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_raibert_controller_example.py @@ -10,7 +10,7 @@ currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentfram parentdir = os.path.dirname(os.path.dirname(os.path.dirname(currentdir))) os.sys.path.insert(0, parentdir) -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.minitaur.envs import minitaur_raibert_controller from pybullet_envs.minitaur.envs import minitaur_gym_env diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_randomize_terrain_gym_env_example.py b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_randomize_terrain_gym_env_example.py index 3ecf6dc9c..ad329136a 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_randomize_terrain_gym_env_example.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_randomize_terrain_gym_env_example.py @@ -5,7 +5,7 @@ import math import numpy as np -import tensorflow as tf +import tf.compat.v1 as tf #from google3.pyglib import app #from google3.pyglib import flags from pybullet_envs.minitaur.envs import minitaur_randomize_terrain_gym_env diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_reactive_env_example.py b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_reactive_env_example.py index e0d4000c1..d4f70a2ee 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_reactive_env_example.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_reactive_env_example.py @@ -13,7 +13,7 @@ parentdir = os.path.dirname(os.path.dirname(os.path.dirname(currentdir))) print("parentdir=", parentdir) os.sys.path.insert(0, parentdir) -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.minitaur.agents.scripts import utility import pybullet_data from pybullet_envs.minitaur.envs import simple_ppo_agent diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_stand_gym_env_example.py b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_stand_gym_env_example.py index aa07bd029..16bae5f71 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_stand_gym_env_example.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_stand_gym_env_example.py @@ -5,7 +5,7 @@ import math import numpy as np -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.minitaur.envs import minitaur_stand_gym_env diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_trotting_env_example.py b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_trotting_env_example.py index e38f86428..604a90261 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_trotting_env_example.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur_trotting_env_example.py @@ -6,7 +6,7 @@ from __future__ import print_function import os import time -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.minitaur.agents.scripts import utility import pybullet_data from pybullet_envs.minitaur.envs import simple_ppo_agent diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/envs/simple_ppo_agent.py b/examples/pybullet/gym/pybullet_envs/minitaur/envs/simple_ppo_agent.py index 85e35ad52..aa329fb0e 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/envs/simple_ppo_agent.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/envs/simple_ppo_agent.py @@ -4,7 +4,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.agents.ppo import normalize from pybullet_envs.agents import utility diff --git a/examples/pybullet/gym/pybullet_envs/minitaur/envs/simple_ppo_agent_example.py b/examples/pybullet/gym/pybullet_envs/minitaur/envs/simple_ppo_agent_example.py index 08808f98d..fbca0cca7 100644 --- a/examples/pybullet/gym/pybullet_envs/minitaur/envs/simple_ppo_agent_example.py +++ b/examples/pybullet/gym/pybullet_envs/minitaur/envs/simple_ppo_agent_example.py @@ -23,7 +23,7 @@ from __future__ import print_function import os import time -import tensorflow as tf +import tf.compat.v1 as tf from pybullet_envs.agents import utility from pybullet_envs.minitaur.agents import simple_ppo_agent diff --git a/examples/pybullet/gym/pybullet_utils/util.py b/examples/pybullet/gym/pybullet_utils/util.py index 5a014c8ed..a2c3905df 100644 --- a/examples/pybullet/gym/pybullet_utils/util.py +++ b/examples/pybullet/gym/pybullet_utils/util.py @@ -4,7 +4,7 @@ import numpy as np def set_global_seeds(seed): try: - import tensorflow as tf + import tf.compat.v1 as tf except ImportError: pass else: diff --git a/examples/pybullet/tensorflow/humanoid_running.py b/examples/pybullet/tensorflow/humanoid_running.py index 8a7f1159f..ffd502fa3 100644 --- a/examples/pybullet/tensorflow/humanoid_running.py +++ b/examples/pybullet/tensorflow/humanoid_running.py @@ -1,4 +1,4 @@ -import tensorflow as tf +import tf.compat.v1 as tf import sys import numpy as np import argparse diff --git a/examples/pybullet/tensorflow/humanoid_running_vr_follow.py b/examples/pybullet/tensorflow/humanoid_running_vr_follow.py index 27148a48b..2df85cd88 100644 --- a/examples/pybullet/tensorflow/humanoid_running_vr_follow.py +++ b/examples/pybullet/tensorflow/humanoid_running_vr_follow.py @@ -1,4 +1,4 @@ -import tensorflow as tf +import tf.compat.v1 as tf import sys import numpy as np