mirror of
https://github.com/bulletphysics/bullet3.git
synced 2026-10-25 10:10:57 +00:00
Replace tensorflow with tf.compat.v1
This means they won't break when using TensorFlow 2.0.
This commit is contained in:
@@ -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():
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import tensorflow as tf
|
||||
import tf.compat.v1 as tf
|
||||
import numpy as np
|
||||
import os
|
||||
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import math
|
||||
|
||||
import tensorflow as tf
|
||||
import tf.compat.v1 as tf
|
||||
import minitaur_ball_gym_env
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import tensorflow as tf
|
||||
import tf.compat.v1 as tf
|
||||
import sys
|
||||
import numpy as np
|
||||
import argparse
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import tensorflow as tf
|
||||
import tf.compat.v1 as tf
|
||||
import sys
|
||||
import numpy as np
|
||||
|
||||
|
||||
Reference in New Issue
Block a user