tf_agents.environments.parallel_py_environment.ProcessPyEnvironment

View source on GitHub

Step a single env in a separate process for lock free paralellism.

env_constructor Callable that creates and returns a Python environment.
flatten Boolean, whether to assume flattened actions and time_steps during communication to avoid overhead.

Methods

action_spec

View source

call

View source

Asynchronously call a method of the external environment.

Args
name Name of the method to call.
*args Positional arguments to forward to the method.
**kwargs Keyword arguments to forward to the method.

Returns
Promise object that blocks and provides the return value when called.

close

View source

Send a close message to the external process and join it.

observation_spec

View source

reset

View source

Reset the environment.

Args
blocking Whether to wait for the result.

Returns
New observation when blocking, otherwise callable that returns the new observation.

start

View source

Start the process.

Args
wait_to_start Whether the call should wait for an env initialization.

step

View source

Step the environment.

Args
action The action to apply to the environment.
blocking Whether to wait for the result.

Returns
time step when blocking, otherwise callable that returns the time step.

time_step_spec

View source

wait_start

View source

Wait for the started process to finish initialization.