tf_agents.environments.parallel_py_environment.ProcessPyEnvironment

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

access

View source

Access an attribute of the external environment.

This method blocks.

Args
name Name of the attribute to access.

Returns
The attribute value.

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
The attribute.

close

View source

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

observation_spec

View source

render

View source

Renders the environment.

Args
mode Rendering mode. Only 'rgb_array' is supported.
blocking Whether to wait for the result.

Returns
An ndarray of shape [width, height, 3] denoting an RGB image when blocking. Otherwise, callable that returns the rendered image.

Raises
NotImplementedError If the environment does not support rendering, or any other modes than rgb_array is given.

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.