Skip to content

Commit

Permalink
Set env seeds whenever environment is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Ziegler committed Nov 26, 2020
1 parent 5417cd1 commit 4ce934c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/garage/sampler/_functions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Functions used by multiple Samplers or Workers."""
from garage import Environment
from garage.experiment import deterministic
from garage.sampler.env_update import EnvUpdate


Expand Down Expand Up @@ -33,6 +34,7 @@ def _apply_env_update(old_env, env_update):
elif isinstance(env_update, Environment):
if old_env is not None:
old_env.close()
env_update.seed(deterministic.get_seed())
return env_update, True
else:
raise TypeError('Unknown environment update type.')
Expand Down

0 comments on commit 4ce934c

Please sign in to comment.