fixed minor back with __getattr__
This commit is contained in:
parent
4fafe86764
commit
92f1f409f3
@ -87,16 +87,16 @@ def example_async(env_id="alr_envs:HoleReacher-v0", n_cpu=4, seed=int('533D', 16
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Basic gym task
|
||||
# example_general("Pendulum-v0", seed=10, iterations=200, render=True)
|
||||
example_general("Pendulum-v0", seed=10, iterations=200, render=True)
|
||||
#
|
||||
# # Basis task from framework
|
||||
# example_general("alr_envs:HoleReacher-v0", seed=10, iterations=200, render=True)
|
||||
example_general("alr_envs:HoleReacher-v0", seed=10, iterations=200, render=True)
|
||||
#
|
||||
# # OpenAI Mujoco task
|
||||
# example_general("HalfCheetah-v2", seed=10, render=True)
|
||||
example_general("HalfCheetah-v2", seed=10, render=True)
|
||||
#
|
||||
# # Mujoco task from framework
|
||||
# example_general("alr_envs:ALRReacher-v0", seed=10, iterations=200, render=True)
|
||||
example_general("alr_envs:ALRReacher-v0", seed=10, iterations=200, render=True)
|
||||
|
||||
# Vectorized multiprocessing environments
|
||||
example_async(env_id="alr_envs:HoleReacher-v0", n_cpu=2, seed=int('533D', 16), n_samples=2 * 200)
|
||||
|
@ -91,9 +91,13 @@ class DMCWrapper(core.Env):
|
||||
# set seed
|
||||
self.seed(seed=task_kwargs.get('random', 1))
|
||||
|
||||
def __getattr__(self, name):
|
||||
"""Delegate attribute access to underlying environment."""
|
||||
return getattr(self._env, name)
|
||||
def __getattr__(self, item):
|
||||
"""Propagate only non-existent properties to wrapped env."""
|
||||
if item.startswith('_'):
|
||||
raise AttributeError("attempted to get missing private attribute '{}'".format(item))
|
||||
if item in self.__dict__:
|
||||
return getattr(self, item)
|
||||
return getattr(self._env, item)
|
||||
|
||||
def _get_obs(self, time_step):
|
||||
if self._from_pixels:
|
||||
|
Loading…
Reference in New Issue
Block a user