Reputation: 444
Suppose you have an environment that has input parameters: for example, to create an instance you would use
env_instance = MyEnv(var_1=3, var_2=5, ...)
Now suppose you want to create a parallel_py_environment using the environment "MyEnv"? Since you need input parameters, you cannot use
tf_py_environment.TFPyEnvironment(parallel_py_environment.ParallelPyEnvironment([MyEnv]*int(n_envs)))
Upvotes: 0
Views: 731
Reputation: 444
The solution is to create a super class:
class MyEnvPar(MyEnv):
def __init__(self):
super().__init__(var_1=3, var_2=5)
And then you can use
tf_py_environment.TFPyEnvironment(parallel_py_environment.ParallelPyEnvironment([MyEnvPar]*int(n_envs)))
Upvotes: 1